duplicate category functions - object reference not set to an instance of object

Feb 13, 2013 at 11:08 PM
I created two parrallel systems for categories for sorting purposes. Everything works fine, except when tryingt o save or update a post I get an 'object reference not set to an instance of object' error.

It appears the problem is in teh admin/ajaxhelper.cs file. If I comment out any two of the systems, the other one will work perfectly, but any two or more created problems.

Any suggestions?

post.Categories.Clear();
            if (cats.Trim().Length > 0)
            {
                var vcats = cats.Trim().Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                foreach (var cat in vcats)
                {
                    post.Categories.Add(Category.GetCategory(new Guid(cat)));
                }
            }

            post.Questions.Clear();
            if (quss.Trim().Length > 0)
            {
                var vquss = quss.Trim().Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                foreach (var qus in vquss)
                {
                    post.Questions.Add(Question.GetQuestion(new Guid(qus)));
                }
            }

            post.Memes.Clear();
            if (mems.Trim().Length > 0)
            {
                var vmems = mems.Trim().Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                foreach (var mem in vmems)
                {
                    post.Memes.Add(Meme.GetMeme(new Guid(mem)));
                }
            }

            post.Save();