Copied to clipboard

Flag this post as spam?

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


  • Yuval Lombard 14 posts 44 karma points
    Mar 04, 2014 @ 15:30
    Yuval Lombard
    0

    Error on creating new post

    Hi guys,

    I'm expriencing this error when trying to submit a new post :

    Failed to load resource: the server responded with a status of 500 (Internal Server Error)

    its not happening everytime which makes it even more weird, and when i debug it, i can see that it falls at this lines in the - public static string NewForumPost(string topicId) method:

    var subscriberIds = forumTopic.SubscriberIds;

    if (loggedInMember.Id == forumPost.Owner.MemberId) { subscriberIds.Remove(loggedInMember.Id); }

    subscriberIds is null it this case

    would love to get some help :)

    thanks a lot!

  • Yuval Lombard 14 posts 44 karma points
    Mar 04, 2014 @ 16:25
    Yuval Lombard
    0

    found the answer!

    in the NewForumPost(string topicId) method, there isnt any checking if the subscriberIds variable is returned NULL

    in that case if there are no subscribers this topic anyone who will submit a post will get an error

    you should change thease lines

    if (loggedInMember.Id == forumPost.Owner.MemberId) => if (subscriberIds != null && loggedInMember.Id == forumPost.Owner.MemberId)

    if (subscriberIds.Count > 0) => if (subscriberIds != null && subscriberIds.Count > 0)

    hope this will help

    cheers!

Please Sign in or register to post replies

Write your reply to:

Draft