Server Error in '/hpj' Application.

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

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

Source Error:


Line 158:        private TypesInfo GetFirstSun(TypesInfo M)
Line 159:        {
Line 160:            IList<TypesInfo> Ms =  GetTree(M.TypeID);
Line 161:            if (Ms.Count > 0)
Line 162:                return GetFirstSun(Ms[0]);

Source File: e:\webroot\hpj\App_Code\DAL\Types.cs    Line: 160

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
   DAL.Types.GetFirstSun(TypesInfo M) in e:\webroot\hpj\App_Code\DAL\Types.cs:160
   DAL.Types.GetFirstSmall(Int32 TypeID) in e:\webroot\hpj\App_Code\DAL\Types.cs:155
   list.Bind(Int32 TypeID) in e:\webroot\hpj\list.aspx.cs:33
   list.Page_Load(Object sender, EventArgs e) in e:\webroot\hpj\list.aspx.cs:22
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +24
   System.Web.UI.Control.LoadRecursive() +70
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3063


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1040