From 3c079bcca053822b259f913245e33904f5e8ef50 Mon Sep 17 00:00:00 2001 From: Ryan Stecker Date: Sat, 5 Jul 2014 10:37:16 -0500 Subject: [PATCH] GetEntityClassname should handle the case where the world entity has not been created yet. --- core/HalfLife2.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/HalfLife2.cpp b/core/HalfLife2.cpp index 2c034d33..da8935fe 100644 --- a/core/HalfLife2.cpp +++ b/core/HalfLife2.cpp @@ -1170,6 +1170,12 @@ const char *CHalfLife2::GetEntityClassname(CBaseEntity *pEntity) if (offset == -1) { CBaseEntity *pGetterEnt = ReferenceToEntity(0); + if (pGetterEnt == NULL) + { + // If we don't have a world entity yet, we'll have to rely on the given entity + pGetterEnt = pEntity; + } + datamap_t *pMap = GetDataMap(pGetterEnt); sm_datatable_info_t info;