Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Muhammad Adeel 19 posts 109 karma points
    Apr 21, 2016 @ 09:32
    Muhammad Adeel
    0

    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 Error Message

    my content page looks like :

    Content Preview

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Apr 21, 2016 @ 09:48
    Bo Damgaard Mortensen
    0

    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:

    string name = a.HasValue("uBlogsyAuthorName") ? a.GetPropertyValue<string>("uBlogsyAuthorName").Trim() : string.Empty;
    

    Hope that helps. If not, please let me know :-)

  • Muhammad Adeel 19 posts 109 karma points
    Apr 21, 2016 @ 10:31
    Muhammad Adeel
    0

    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?

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Apr 21, 2016 @ 10:38
    Bo Damgaard Mortensen
    0

    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?

  • Muhammad Adeel 19 posts 109 karma points
    Apr 21, 2016 @ 10:58
    Muhammad Adeel
    0

    Yes sir i have entered the uBlogsyAuthorName value. actually "Author Name" is the Name of the field, On mouse hover i get the alias.AuthorName

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Apr 21, 2016 @ 20:14
    Bo Damgaard Mortensen
    100

    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:

    @using Umbraco.Core.Models
    @using Umbraco.Web
    

    to the following views:

    uBlogsyPostListAuthors.cshtml
    uBlogsyWidgetListAuthors.cshtml
    

    This should fix the issue :-)

  • Muhammad Adeel 19 posts 109 karma points
    Apr 22, 2016 @ 09:17
    Muhammad Adeel
    0

    thanks mate!!!

  • Nicholas Westby 2054 posts 7104 karma points c-trib
    Apr 21, 2016 @ 20:28
    Nicholas Westby
    0

    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/

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies