mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-24 07:06:08 +00:00
Fix atlas crash with RM capture the relic.
As no default values got set, some game settings became NaN, which triggered exceptions. This sets sane default. This also includes better debugging logic in case of exception, so it's easier to know what happens. Fixes #6200 Reported by: langbart Differential Revision: https://code.wildfiregames.com/D4113 This was SVN commit r25736.
This commit is contained in:
@@ -20,6 +20,8 @@
|
||||
#include "ScriptComponent.h"
|
||||
|
||||
#include "scriptinterface/FunctionWrapper.h"
|
||||
#include "scriptinterface/JSON.h"
|
||||
#include "scriptinterface/ScriptInterface.h"
|
||||
#include "scriptinterface/Object.h"
|
||||
#include "simulation2/serialization/ISerializer.h"
|
||||
#include "simulation2/serialization/IDeserializer.h"
|
||||
@@ -60,7 +62,20 @@ void CComponentTypeScript::Serialize(ISerializer& serialize)
|
||||
{
|
||||
ScriptRequest rq(m_ScriptInterface);
|
||||
|
||||
serialize.ScriptVal("comp", &m_Instance);
|
||||
try
|
||||
{
|
||||
serialize.ScriptVal("comp", &m_Instance);
|
||||
}
|
||||
catch(PSERROR_Serialize& err)
|
||||
{
|
||||
int ent = INVALID_ENTITY;
|
||||
Script::GetProperty(rq, m_Instance, "entity", ent);
|
||||
std::string name = "(error)";
|
||||
Script::GetObjectClassName(rq, m_Instance, name);
|
||||
LOGERROR("Script component %s of entity %i failed to serialize: %s\nSerializing:\n%s", name, ent, err.what(), Script::ToString(rq, &m_Instance));
|
||||
// Rethrow now that we added more details
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
void CComponentTypeScript::Deserialize(const CParamNode& paramNode, IDeserializer& deserialize, entity_id_t ent)
|
||||
|
||||
Reference in New Issue
Block a user