Assert whenever an invalid journal entry is encountered.
This commit is contained in:
parent
942389a503
commit
df344dc065
|
@ -322,16 +322,14 @@ Loggable::do_this ( const char *s, bool reverse )
|
||||||
{
|
{
|
||||||
unsigned int id = 0;
|
unsigned int id = 0;
|
||||||
|
|
||||||
if ( ! ( sscanf( s, "%*s %X ", &id ) > 0 ) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
Loggable *l = find( id );
|
|
||||||
// assert( l );
|
|
||||||
|
|
||||||
char classname[40];
|
char classname[40];
|
||||||
char command[40];
|
char command[40];
|
||||||
char *arguments = NULL;
|
char *arguments = NULL;
|
||||||
|
|
||||||
|
int found = sscanf( s, "%s %X %s ", classname, &id, command );
|
||||||
|
|
||||||
|
ASSERT( 3 == found, "Invalid journal entry format \"%s\"", s );
|
||||||
|
|
||||||
const char *create, *destroy;
|
const char *create, *destroy;
|
||||||
|
|
||||||
if ( reverse )
|
if ( reverse )
|
||||||
|
@ -352,6 +350,8 @@ Loggable::do_this ( const char *s, bool reverse )
|
||||||
|
|
||||||
if ( ! strcmp( command, destroy ) )
|
if ( ! strcmp( command, destroy ) )
|
||||||
{
|
{
|
||||||
|
Loggable *l = find( id );
|
||||||
|
|
||||||
/* deleting eg. a track, which contains a list of other
|
/* deleting eg. a track, which contains a list of other
|
||||||
widgets, causes destroy messages to be emitted for all those
|
widgets, causes destroy messages to be emitted for all those
|
||||||
widgets, but when replaying the journal the destroy message
|
widgets, but when replaying the journal the destroy message
|
||||||
|
@ -365,6 +365,10 @@ Loggable::do_this ( const char *s, bool reverse )
|
||||||
{
|
{
|
||||||
// printf( "got set command (%s).\n", arguments );
|
// printf( "got set command (%s).\n", arguments );
|
||||||
|
|
||||||
|
Loggable *l = find( id );
|
||||||
|
|
||||||
|
ASSERT( l, "Unable to find object 0x%X referenced by command \"%s\"", id, s );
|
||||||
|
|
||||||
Log_Entry e( arguments );
|
Log_Entry e( arguments );
|
||||||
|
|
||||||
l->log_start();
|
l->log_start();
|
||||||
|
@ -687,8 +691,8 @@ Loggable::log_create ( void ) const
|
||||||
{
|
{
|
||||||
if ( ! _fp )
|
if ( ! _fp )
|
||||||
/* replaying, don't bother */
|
/* replaying, don't bother */
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
log( "%s 0x%X create ", class_name(), _id );
|
log( "%s 0x%X create ", class_name(), _id );
|
||||||
|
|
||||||
Log_Entry e;
|
Log_Entry e;
|
||||||
|
|
Loading…
Reference in New Issue