From: <fu...@us...> - 2009-02-11 15:01:18
|
Revision: 5683 http://gemrb.svn.sourceforge.net/gemrb/?rev=5683&view=rev Author: fuzzie Date: 2009-02-11 15:01:09 +0000 (Wed, 11 Feb 2009) Log Message: ----------- try to handle unexpected errors in DialogChoose Modified Paths: -------------- gemrb/trunk/gemrb/plugins/Core/GameControl.cpp Modified: gemrb/trunk/gemrb/plugins/Core/GameControl.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/GameControl.cpp 2009-02-11 12:11:20 UTC (rev 5682) +++ gemrb/trunk/gemrb/plugins/Core/GameControl.cpp 2009-02-11 15:01:09 UTC (rev 5683) @@ -1988,6 +1988,10 @@ void GameControl::InitDialog(Scriptable* spk, Scriptable* tgt, const char* dlgref) { + if (dlg) { + delete dlg; + dlg = NULL; + } if (tgt->GetInternalFlag()&IF_NOINT) { core->DisplayConstantString(STR_TARGETBUSY,0xff0000); return; @@ -1995,9 +1999,6 @@ DialogMgr* dm = ( DialogMgr* ) core->GetInterface( IE_DLG_CLASS_ID ); dm->Open( core->GetResourceMgr()->GetResource( dlgref, IE_DLG_CLASS_ID ), true ); - if (dlg) { - delete dlg; - } dlg = dm->GetDialog(); core->FreeInterface( dm ); @@ -2228,8 +2229,20 @@ ieResRef tmpresref; strnlwrcpy(tmpresref,tr->Dialog, 8); InitDialog( speaker, target, tmpresref ); + if (!dlg) { + // error was displayed by InitDialog + ta->SetMinRow( false ); + EndDialog(); + return; + } } ds = dlg->GetState( si ); + if (!ds) { + printMessage("Dialog","Can't find next dialog\n",YELLOW); + ta->SetMinRow( false ); + EndDialog(); + return; + } } //displaying npc text core->DisplayStringName( ds->StrRef, 0x70FF70, target, IE_STR_SOUND|IE_STR_SPEECH); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |