DEADSOFTWARE

non-headless game server should not crash on map view anymore
[d2df-sdl.git] / src / game / g_monsters.pas
index 4cba5acb10b21bd2487e25d577e7a4611455449a..e496521d4485a3ada649639ff4b7ebec96ae0bcf 100644 (file)
@@ -322,8 +322,8 @@ uses
 procedure g_Mons_ProfilersBegin ();
 begin
   if (profMonsLOS = nil) then profMonsLOS := TProfiler.Create('LOS CALC', g_profile_history_size);
-  profMonsLOS.mainBegin(g_profile_los);
-  if g_profile_los then
+  if (profMonsLOS <> nil) then profMonsLOS.mainBegin(g_profile_los);
+  if g_profile_los and (profMonsLOS <> nil) then
   begin
     profMonsLOS.sectionBegin('loscalc');
     profMonsLOS.sectionEnd();
@@ -332,17 +332,17 @@ end;
 
 procedure g_Mons_ProfilersEnd ();
 begin
-  if (profMonsLOS <> nil) and (g_profile_los) then profMapCollision.mainEnd();
+  if (profMonsLOS <> nil) and (g_profile_los) then profMonsLOS.mainEnd();
 end;
 
 procedure g_Mons_LOS_Start (); inline;
 begin
-  profMonsLOS.sectionBeginAccum('loscalc');
+  if (profMonsLOS <> nil) then profMonsLOS.sectionBeginAccum('loscalc');
 end;
 
 procedure g_Mons_LOS_End (); inline;
 begin
-  profMonsLOS.sectionEnd();
+  if (profMonsLOS <> nil) then profMonsLOS.sectionEnd();
 end;