1

Resolved

Last Comments Query Projection : Error with CommentedOn

description

using a query that displays the last comments, I use Content.CommentedOn.DisplayUrl and Content.CommentedOn.DisplayText to display a link to the parent Content (i.e : Blog Post)
Then I add a projection widget with this query.

It works but each time I display, I have a log error :
Orchard.Exceptions.DefaultExceptionPolicy - An unexpected exception was caught
    System.NullReferenceException: Object reference not set to an instance of an object.
   at Orchard.Comments.Tokens.CommentTokens.<Evaluate>b__9(IContent content) in c:\inetpub\wwwroot\OrchardBlog\src\Orchard.Web\Modules\Orchard.Comments\Tokens\CommentTokens.cs:line 45

comments

Piedone wrote Jun 27, 2013 at 9:45 PM

Hmm, the issue is that tokenizing runs also with the ProjectionWidget itself as Content, from ProjectionPartDriver ln 141.

sebastienros wrote Jun 28, 2013 at 2:35 AM

Where are your tokens ? In a Layout ?

sebastienros wrote Jun 28, 2013 at 2:52 AM

Fixed in changeset bfc424db6ca3

sebastienros wrote Jun 28, 2013 at 2:54 AM

I fixed it but please review the change as it might have huge implications. I assume it was actually not used at it made no sense at all. Tokenizing a field using itself is useless and actually was creating exceptions.

By the way, I hope you have noticed the nice CommentApproveUrl and related tokens that you can use in emails to quickly approve/delete/moderate a comment. Enjoy.

sfmskywalker wrote Mar 28 at 1:28 AM

Fixed in changeset 16f63a5ed0d354a69e1e1a300b07dcad0b60ae2b