Commit c436f453 authored by Martin Janitschke's avatar Martin Janitschke Committed by Wayne Stambaugh

Fix 3D viewer crash bug. (fixes lp:673603 and lp:804778)

parent df8b7c53
...@@ -68,6 +68,8 @@ void VRML_MODEL_PARSER::Load( const wxString aFilename ) ...@@ -68,6 +68,8 @@ void VRML_MODEL_PARSER::Load( const wxString aFilename )
while( GetLine( file, line, &LineNum, 512 ) ) while( GetLine( file, line, &LineNum, 512 ) )
{ {
text = strtok( line, sep_chars ); text = strtok( line, sep_chars );
if ( text == NULL )
continue;
if( stricmp( text, "DEF" ) == 0 || stricmp( text, "Group" ) == 0 ) if( stricmp( text, "DEF" ) == 0 || stricmp( text, "Group" ) == 0 )
{ {
...@@ -371,6 +373,9 @@ int VRML_MODEL_PARSER::readGeometry( FILE* file, int* LineNum ) ...@@ -371,6 +373,9 @@ int VRML_MODEL_PARSER::readGeometry( FILE* file, int* LineNum )
strcpy( buffer, line ); strcpy( buffer, line );
text = strtok( buffer, sep_chars ); text = strtok( buffer, sep_chars );
if( text == NULL )
continue;
if( *text == '}' ) if( *text == '}' )
{ {
err = 0; err = 0;
...@@ -381,7 +386,7 @@ int VRML_MODEL_PARSER::readGeometry( FILE* file, int* LineNum ) ...@@ -381,7 +386,7 @@ int VRML_MODEL_PARSER::readGeometry( FILE* file, int* LineNum )
{ {
text = strtok( NULL, " ,\t\n\r" ); text = strtok( NULL, " ,\t\n\r" );
if( stricmp( text, "true" ) == 0 ) if( text && stricmp( text, "true" ) == 0 )
{ {
} }
else else
...@@ -395,7 +400,7 @@ int VRML_MODEL_PARSER::readGeometry( FILE* file, int* LineNum ) ...@@ -395,7 +400,7 @@ int VRML_MODEL_PARSER::readGeometry( FILE* file, int* LineNum )
{ {
text = strtok( NULL, " ,\t\n\r" ); text = strtok( NULL, " ,\t\n\r" );
if( stricmp( text, "true" ) == 0 ) if( text && stricmp( text, "true" ) == 0 )
{ {
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment