This project is read-only.


NullReferenceException in LanguageSelector.cs


Even if a language is disabled, posts in the disabled language set can be shown and linked in "Available also in:" correctly. But exception thrown when trying to edit the post.

Exception Details:

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 90: }
Line 91:
Line 92: SelectedLanguageText = Items.FindByValue(SelectedCulture).Text;
Line 93: }
Line 94:
Source File: c:\InetPub\App_Code\Controls\LanguageSelector.cs Line: 92
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
Controls.LanguageSelector.bindLanguages() in c:\InetPub\App_Code\Controls\LanguageSelector.cs:92
Controls.LanguageSelector.OnPagePreLoad(Object sender, EventArgs e) in c:\InetPub\App_Code\Controls\LanguageSelector.cs:25
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Page.OnPreLoad(EventArgs e) +111
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +554

Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053

Closed Mar 23, 2009 at 7:29 PM by jkoblizek
Quick fix can be found in the comment below.


jkoblizek wrote Mar 23, 2009 at 7:26 PM

Problem is in missing language in Items list, that's why the exception is thrown.
Solution is to add the following code to delegate on line 102 in BlogEngine.Core/Web/Controls/PostViewBase.cs:
&& item.Id.Culture.Active

wrote Mar 23, 2009 at 7:27 PM

wrote Mar 23, 2009 at 7:29 PM

wrote Jul 7, 2012 at 6:04 PM

wrote Feb 12, 2013 at 8:22 PM

wrote May 15, 2013 at 4:40 AM