DIRECTOR: For disposed objects, make getMethod return a warning

D4 will throw an exception if you try and use a method on a disposed
object. In the editor this halts execution, in the projector this seems
to just be ignored. As there are games which rely on this ignorance,
we can't halt on a disposed object.

Fixes the EXE loader in Opera Fatal.
This commit is contained in:
Scott Percival 2023-01-27 00:31:27 +08:00 committed by Eugene Sandulenko
parent 5e36a43ea0
commit 6444b9dfd5

View File

@ -132,8 +132,11 @@ public:
};
Symbol getMethod(const Common::String &methodName) override {
Symbol sym;
if (_disposed) {
error("Method '%s' called on disposed object <%s>", methodName.c_str(), asString().c_str());
warning("Method '%s' called on disposed object <%s>, returning VOID", methodName.c_str(), asString().c_str());
return sym;
}
Common::String methodId;
@ -143,8 +146,6 @@ public:
methodId = methodName;
}
Symbol sym;
if (_methods && _methods->contains(methodId)) {
sym = (*_methods)[methodId];
sym.target = this;