System.NullReferenceException in example app

noobs

16-11-2009 22:20:00

I keep getting a "A first chance exception of type 'System.NullReferenceException' occurred in Mogre.dll" and i debugged it to this code sniped in example application.

haven't look any further in to it. is it some common thing when we just ignore it?

// update stats when necessary
try
{
OverlayElement guiAvg = OverlayManager.Singleton.GetOverlayElement("Core/AverageFps");
OverlayElement guiCurr = OverlayManager.Singleton.GetOverlayElement("Core/CurrFps");
OverlayElement guiBest = OverlayManager.Singleton.GetOverlayElement("Core/BestFps");
OverlayElement guiWorst = OverlayManager.Singleton.GetOverlayElement("Core/WorstFps");

RenderTarget.FrameStats stats = window.GetStatistics();

guiAvg.Caption = avgFps + stats.AvgFPS;
guiCurr.Caption = currFps + stats.LastFPS;
guiBest.Caption = bestFps + stats.BestFPS + " " + stats.BestFrameTime + " ms";
guiWorst.Caption = worstFps + stats.WorstFPS + " " + stats.WorstFrameTime + " ms";

OverlayElement guiTris = OverlayManager.Singleton.GetOverlayElement("Core/NumTris");
guiTris.Caption = tris + stats.TriangleCount;

OverlayElement guiDbg = OverlayManager.Singleton.GetOverlayElement("Core/DebugText");
guiDbg.Caption = mDebugText;
}
catch
{
// ignore
}

AndroidAdam

17-11-2009 22:59:16

It's not inherently bad if it ignores it, but it might mean that you don't have your media or your resources.cfg set up correctly.