Copied to clipboard

Flag this post as spam?

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


  • Michael McDougall 5 posts 95 karma points
    Oct 11, 2018 @ 23:43
    Michael McDougall
    0

    G'day Community,

    I am pretty new to Umbraco and have a site for a client, she reached out to me yesterday with an unusual error, It seems to only be happening on the home page and one other page of the site & apparently did not do anything prior to the error occurring.

    I am wondering if someone out there is able to help me out with this one please:

    Server Error in '/' Application.

    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 88:

    Line 89:

    Line 90: @foreach (RelatedLink link in listingPages)

    Line 91: {

    Line 92:

    tab-name-@Model.Id-@listPage" role="tabpanel" class="tab-pane @if(listPage == 1){@Html.Raw("active")}">

  • Jan Skovgaard 11242 posts 23391 karma points MVP 6x admin c-trib
    Oct 13, 2018 @ 17:23
    Jan Skovgaard
    0

    Hi Michael and welcome to the Umbraco forum :-)

    I have a suspicion that somewhere in the code there is a null check missing - A link that has previously been valid might not be anymore because maybe the document/node it referenced has been deleted.

    So if you're able to find the template that is supposed to render the code that triggers this error and paste it in here we should be able to figure out the issue.

    From the top of my head I'm guessting that you need to ad an if check around the code so something like the following should do the trick I suspect.

    @if(listingsPages.Any()){
    // Loop goes here
    }
    

    But if you can post the full code it's easier to point you in the correct direction :-)

    Looking forward to hearing from you!

    /Jan

  • Michael McDougall 5 posts 95 karma points
    Oct 14, 2018 @ 02:13
    Michael McDougall
    0

    G'day Jan,

    I really appreciate your reply back to my issue, The more I look into it I think it may have been something that the client triggered from inside the admin section to cause the error, but I am still not 100% sure, I cant seem to upload the full stack trace here so I have put it online here if you get a free chance to maybe have a look stack trace

    Again I am very grateful that you have taken the time to reply.

    Cheers from Michael

  • Jan Skovgaard 11242 posts 23391 karma points MVP 6x admin c-trib
    Oct 14, 2018 @ 08:45
    Jan Skovgaard
    0

    Hi Michael

    But perhaps the reason why you client is able to trigger it from within the backoffice is because a null check is missing perhaps? :) I don't know how your site is setup etc. - But I suppose they're able to only edit the content and not do some fancy injection of code etc? As mentioned in my first post I have a strong suspicion that either a content node or a media item referenced in that content node has either been unpublished or deleted for instance, which could be the cause of the error that you're experiencing. That would of course be something that the client did but in my opinion we should make sure to avoid issues like this trigger a yellow screen error so the solution is more robust.

    Then the client might wonder why a certain node or image is not rendering as they expected it to but at least the site won't break :)

    I would still like to see the code snippet for rendering the list of links that you're using.

    Did you try and add a check around the for loop like I suggested about? :)

    Looking to hearing from you!

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft