aboutsummaryrefslogtreecommitdiff
path: root/engines/wage
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2017-12-08 12:33:40 +0100
committerEugene Sandulenko2017-12-08 11:41:32 +0000
commitc6c39d557850157d94e8e42d3f79391640264689 (patch)
tree426a432e472b6e4190328f134ae257b69a654da1 /engines/wage
parentf35cb961f2beb1bcfb3e8e3b9e96011ae5d1df13 (diff)
downloadscummvm-rg350-c6c39d557850157d94e8e42d3f79391640264689.tar.gz
scummvm-rg350-c6c39d557850157d94e8e42d3f79391640264689.tar.bz2
scummvm-rg350-c6c39d557850157d94e8e42d3f79391640264689.zip
WAGE: Handle null strings in toString and improve consistency
Diffstat (limited to 'engines/wage')
-rw-r--r--engines/wage/script.cpp17
-rw-r--r--engines/wage/script.h2
2 files changed, 15 insertions, 4 deletions
diff --git a/engines/wage/script.cpp b/engines/wage/script.cpp
index de0b6bdb0e..7a8ba14ad4 100644
--- a/engines/wage/script.cpp
+++ b/engines/wage/script.cpp
@@ -63,13 +63,24 @@ static Common::String toString(const Designed *d) {
return d->toString();
}
-Common::String Script::Operand::toString() {
+static Common::String toString(const Common::String *d) {
+ if (!d)
+ return "<NULL>";
+ else
+ return *d;
+}
+
+static Common::String toString(int16 val) {
+ return Common::String::format("%d", val);
+}
+
+Common::String Script::Operand::toString() const {
switch(_type) {
case NUMBER:
- return Common::String::format("%d", _value.number);
+ return Wage::toString(_value.number);
case STRING:
case TEXT_INPUT:
- return *_value.string;
+ return Wage::toString(_value.string);
case OBJ:
return Wage::toString(_value.obj);
case CHR:
diff --git a/engines/wage/script.h b/engines/wage/script.h
index df7ec7e4d6..279e4cfae8 100644
--- a/engines/wage/script.h
+++ b/engines/wage/script.h
@@ -119,7 +119,7 @@ private:
delete _value.string;
}
- Common::String toString();
+ Common::String toString() const;
};
struct ScriptText {