Null reference error on getting value of Document type fields
I have just installed version 7.4.3 and installed Ublogsy on it , After the installation i just published the site . the home page works fine but when i try to preview the blog "Test Title" from the sample added by umbraco ublogsy installation, i get the following error. I have not changed any code from templates or partials. screenshots are
Could it be that your uBlogsyAuthorName haven't got a value? If that's the case, you're calling .Trim() in a null object which throws the null pointer exception you're getting.
Perhaps try use this, which checks if the property actually has got a value, before attempting to use it:
string name = a.HasValue("uBlogsyAuthorName") ? a.GetPropertyValue<string>("uBlogsyAuthorName").Trim() : string.Empty;
as you can see in second screen shot i have created an author by the name "Adeel". i also double checked it. Yeah i know this will ressolve my error for the time being but why its not picking up the author name?
I have used uBlogsy before and it caused some very annoying issues (most especially with uCommentsy). It also hasn't been updated in over a year. Have you considered Articulate?: https://our.umbraco.org/projects/starter-kits/articulate/
Null reference error on getting value of Document type fields
I have just installed version 7.4.3 and installed Ublogsy on it , After the installation i just published the site . the home page works fine but when i try to preview the blog "Test Title" from the sample added by umbraco ublogsy installation, i get the following error. I have not changed any code from templates or partials. screenshots are
my content page looks like :
Hi Muhammad,
Could it be that your
uBlogsyAuthorName
haven't got a value? If that's the case, you're calling.Trim()
in a null object which throws the null pointer exception you're getting.Perhaps try use this, which checks if the property actually has got a value, before attempting to use it:
Hope that helps. If not, please let me know :-)
as you can see in second screen shot i have created an author by the name "Adeel". i also double checked it. Yeah i know this will ressolve my error for the time being but why its not picking up the author name?
Hi Muhammad,
Yes, I'm aware that the author node is created, but still, does the property "uBlogsyAuthorName" have a value? :-)
And further: have you selected Adeel as the author of the post you're viewing?
Yes sir i have entered the uBlogsyAuthorName value. actually "Author Name" is the Name of the field, On mouse hover i get the alias.
Hi Muhammad,
I've now installed uBlogsy on a fresh Umbraco 7.4.3 and can definitely reproduce the exception that you're facing.
The exception is thrown on the method
GetPropertyValue<T>(string propertyTypeAlias)
simply because a reference is missing.This is fixed by added the following references:
to the following views:
This should fix the issue :-)
thanks mate!!!
I have used uBlogsy before and it caused some very annoying issues (most especially with uCommentsy). It also hasn't been updated in over a year. Have you considered Articulate?: https://our.umbraco.org/projects/starter-kits/articulate/
is working on a reply...