aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2017-12-08 02:00:42 +0100
committerEugene Sandulenko2017-12-08 11:41:32 +0000
commitf35cb961f2beb1bcfb3e8e3b9e96011ae5d1df13 (patch)
tree9b64d23db22712a6d9f5a093f6ca679dd2b17859
parent257a99bdb8d933290c79464086aa3860f12dd1f6 (diff)
downloadscummvm-rg350-f35cb961f2beb1bcfb3e8e3b9e96011ae5d1df13.tar.gz
scummvm-rg350-f35cb961f2beb1bcfb3e8e3b9e96011ae5d1df13.tar.bz2
scummvm-rg350-f35cb961f2beb1bcfb3e8e3b9e96011ae5d1df13.zip
WAGE: Avoid calling method of nullptr
-rw-r--r--engines/wage/entities.h2
-rw-r--r--engines/wage/script.cpp15
2 files changed, 12 insertions, 5 deletions
diff --git a/engines/wage/entities.h b/engines/wage/entities.h
index 0b5f96d37a..4f08cbb0c3 100644
--- a/engines/wage/entities.h
+++ b/engines/wage/entities.h
@@ -125,7 +125,7 @@ public:
void setDesignBounds(Common::Rect *bounds);
- Common::String toString() { return _name; }
+ Common::String toString() const { return _name; }
};
class Chr : public Designed {
diff --git a/engines/wage/script.cpp b/engines/wage/script.cpp
index 9f8093c50c..de0b6bdb0e 100644
--- a/engines/wage/script.cpp
+++ b/engines/wage/script.cpp
@@ -56,6 +56,13 @@
namespace Wage {
+static Common::String toString(const Designed *d) {
+ if (!d)
+ return "<NULL>";
+ else
+ return d->toString();
+}
+
Common::String Script::Operand::toString() {
switch(_type) {
case NUMBER:
@@ -64,13 +71,13 @@ Common::String Script::Operand::toString() {
case TEXT_INPUT:
return *_value.string;
case OBJ:
- return _value.obj->toString();
+ return Wage::toString(_value.obj);
case CHR:
- return _value.chr->toString();
+ return Wage::toString(_value.chr);
case SCENE:
- return _value.scene->toString();
+ return Wage::toString(_value.scene);
case CLICK_INPUT:
- return _value.inputClick->toString();
+ return Wage::toString(_value.inputClick);
default:
error("Unhandled operand type: _type");
}