Don’t freeze if delta frame is invalid, just fallback to a valid one
diff --git a/src/engine/client/clientParse.cpp b/src/engine/client/clientParse.cpp
index 933a8b6..3f9b53b 100644
--- a/src/engine/client/clientParse.cpp
+++ b/src/engine/client/clientParse.cpp
@@ -516,10 +516,27 @@ void idClientParseSystemLocal::ParseSnapshot( msg_t* msg )
else
{
old = &cl.snapshots[newSnap.deltaNum & PACKET_MASK];
+
if( !old->valid )
{
// should never happen
Com_Printf( "Delta from invalid frame (not supposed to happen!).\n" );
+
+ while( ( newSnap.deltaNum & PACKET_MASK ) != ( newSnap.messageNum & PACKET_MASK ) && !old->valid )
+ {
+ newSnap.deltaNum++;
+ old = &cl.snapshots[newSnap.deltaNum & PACKET_MASK];
+ }
+
+ if( old->valid )
+ {
+ Com_Printf( "Found more recent frame to delta from.\n" );
+ }
+ }
+
+ if( !old->valid )
+ {
+ Com_Printf( "Failed to find more recent frame to delta from.\n" );
}
else if( old->messageNum != newSnap.deltaNum )
{
diff --git a/src/engine/framework/CmdSystem.cpp b/src/engine/framework/CmdSystem.cpp
index f230d44..eb6a2ff 100644
--- a/src/engine/framework/CmdSystem.cpp
+++ b/src/engine/framework/CmdSystem.cpp
@@ -1857,7 +1857,12 @@ void idCmdSystemLocal::RemoveCommand( pointer cmd_name )
if( !strcmp( cmd_name, cmd->name ) )
{
*back = cmd->next;
- Z_Free( cmd->name );
+
+ if( cmd->name )
+ {
+ Z_Free( cmd->name );
+ }
+
Z_Free( cmd );
return;
}
GitHub
sha: 5f501049