From 7a3b80a9b7f414967fe59f89ab0fe5416735babe Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Sun, 31 Jan 2021 20:44:39 +0100 Subject: First batch of fixes (CallAndMessage) --- src/entities/Physical.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'src/entities/Physical.cpp') diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp index ed01297e..4088f1d1 100644 --- a/src/entities/Physical.cpp +++ b/src/entities/Physical.cpp @@ -126,6 +126,8 @@ CPhysical::Add(void) break; default: assert(0); + debug("This shouldn't happen"); + return; } CPtrNode *node = list->InsertItem(this); assert(node); @@ -191,17 +193,20 @@ CPhysical::RemoveAndAdd(void) list = &s->m_lists[ENTITYLIST_OBJECTS_OVERLAP]; break; } - if(next){ - // If we still have old nodes, use them - next->list->RemoveNode(next->listnode); - list->InsertNode(next->listnode); - next->list = list; - next->sector = s; - next = next->next; - }else{ - CPtrNode *node = list->InsertItem(this); - m_entryInfoList.InsertItem(list, node, s); - } +#ifdef FIX_BUGS + if(list) +#endif + if(next) { + // If we still have old nodes, use them + next->list->RemoveNode(next->listnode); + list->InsertNode(next->listnode); + next->list = list; + next->sector = s; + next = next->next; + } else { + CPtrNode *node = list->InsertItem(this); + m_entryInfoList.InsertItem(list, node, s); + } } // Remove old nodes we no longer need -- cgit v1.2.3