Fixed bug with std::bad_alloc when using produce()

I'm not sure why it wasn't happening before, but it's fixed :)
dev-ui
krzys-h 2013-05-12 15:37:23 +02:00
parent c25b6ab472
commit 1f77efb9cb
1 changed files with 4 additions and 2 deletions

View File

@ -1544,8 +1544,10 @@ bool CScript::rProduce(CBotVar* var, CBotVar* result, int& exception, void* user
return true;
}
object->ReadProgram(0, static_cast<const char*>(name));
object->RunProgram(0);
if(name[0] != 0) {
object->ReadProgram(0, static_cast<const char*>(name));
object->RunProgram(0);
}
result->SetValInt(0); // no error
return true;