]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/lib/intrusivelist.qh
Optimize IL_REMOVE_RAW. It fixes #2827 (a map with a huge amount of entities crashes...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / intrusivelist.qh
index d3a56ba4df9f0b1e499bf0efc1f67d980487635e..385f7b3b13282edb9deb40f0252d679923f3c8ff 100644 (file)
@@ -274,9 +274,12 @@ void IL_ENDFRAME()
 // it should be used only in very particular cases such as after a copyentity call
 void IL_REMOVE_RAW(entity it)
 {
-       it.il_lists = '0 0 0';
-       for (int i = 0; i < IL_MAX * 2; ++i)
-               it.il_links_flds[i] = nil;
+       if (it.il_lists)
+       {
+               it.il_lists = '0 0 0';
+               for (int i = 0; i < IL_MAX * 2; ++i)
+                       it.il_links_flds[i] = nil;
+       }
 }
 
 // called when an entity is deleted with delete() / remove()