Server Error in '/' Application.

Object reference not set to an instance of an object.

Description: An unhandled exception occurred.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
   TheFA.ClubWembley.DataAccess.Repositories.GalleryRepository.GetLatestGalleries(Int32 maxGalleries, ID templateId) in C:\tfs\WembleyClub\ComUpgrade\Source\TheFA.ClubWembley.DataAccess\Repositories\GalleryRepository.cs:94
   TheFA.ClubWembley.Domain.ViewModelBuilder.Gallery.GalleryViewModelBuilder.GetLatestVideos(Int32 max) in C:\tfs\WembleyClub\ComUpgrade\Source\TheFA.ClubWembley.Domain.ViewModelBuilder\Gallery\GalleryViewModelBuilder.cs:43
   TheFA.ClubWembley.Web.Areas.Gallery.Controllers.VideoController.Index() +404
   lambda_method(Closure , ControllerBase , Object[] ) +78
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +257
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +38
   System.Web.Mvc.<>c__DisplayClass13.<InvokeActionMethodWithFilters>b__10() +123
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +800286
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +800286
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +800286
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +800286
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +800286
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +800286
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +800286
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +307
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +345