Reporter | Fitzchak Yitzchaki (fitzchak) |
---|---|
Created | Jan 5, 2012 2:50:15 PM |
Updated | Jan 5, 2012 8:04:33 PM |
Resolved | Jan 5, 2012 3:50:39 PM |
Priority | Normal |
Type | Bug |
Fix versions | No Fix versions |
State | Won't fix |
Assignee | Evgeny Pasynkov (pasynkov) |
Subsystem | No subsystem |
Affected versions | 6.1.1 |
Fixed in build | No Fixed in build |
This code is taken from an open source project: RaccoonBlog.
https://github.com/fitzchak1/RaccoonBlog/blob/master/RaccoonBlog.Web/Areas/Admin/Controllers/PostsController.cs#L172
This the relevant code:
public ActionResult CommentsAdmin(int id, CommentCommandOptions command, int[] commentIds)
{
if (commentIds == null)
ModelState.AddModelError("CommentIdsAreEmpty", "Not comments was selected.");
if (ModelState.IsValid == false)
return Details(id);
switch (command)
{
case CommentCommandOptions.Delete:
comments.Comments.RemoveAll(c => commentIds.Contains(c.Id)); <– here is the issue. commentIds can never be null at this point, because of the above code.
comments.Spam.RemoveAll(c => commentIds.Contains(c.Id));
break;
https://github.com/fitzchak1/RaccoonBlog/blob/master/RaccoonBlog.Web/Areas/Admin/Controllers/PostsController.cs#L172
This the relevant code:
public ActionResult CommentsAdmin(int id, CommentCommandOptions command, int[] commentIds)
{
if (commentIds == null)
ModelState.AddModelError("CommentIdsAreEmpty", "Not comments was selected.");
if (ModelState.IsValid == false)
return Details(id);
switch (command)
{
case CommentCommandOptions.Delete:
comments.Comments.RemoveAll(c => commentIds.Contains(c.Id)); <– here is the issue. commentIds can never be null at this point, because of the above code.
comments.Spam.RemoveAll(c => commentIds.Contains(c.Id));
break;