aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sherlock')
-rw-r--r--engines/sherlock/objects.cpp2
-rw-r--r--engines/sherlock/user_interface.cpp8
2 files changed, 6 insertions, 4 deletions
diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp
index 8c8d90579c..49f64c85b0 100644
--- a/engines/sherlock/objects.cpp
+++ b/engines/sherlock/objects.cpp
@@ -828,7 +828,7 @@ int Object::checkNameForCodes(const Common::String &name, const char *const mess
if (name.hasPrefix("*")) {
// A code was found
printed = true;
- ch = toupper(name[1]);
+ ch = (name == "*") ? 0 : toupper(name[1]);
switch (ch) {
case 'C':
diff --git a/engines/sherlock/user_interface.cpp b/engines/sherlock/user_interface.cpp
index 7a581ca63b..ed3debe2fc 100644
--- a/engines/sherlock/user_interface.cpp
+++ b/engines/sherlock/user_interface.cpp
@@ -2609,7 +2609,8 @@ void UserInterface::checkAction(ActionType &action, const char *const messages[]
events.setCursor(WAIT);
for (int nameIdx = 0; nameIdx < 4; ++nameIdx) {
- if (action._names[nameIdx].hasPrefix("*") && toupper(action._names[nameIdx][1]) == 'W') {
+ if (action._names[nameIdx].hasPrefix("*") && action._names[nameIdx].size() >= 2
+ && toupper(action._names[nameIdx][1]) == 'W') {
if (obj.checkNameForCodes(Common::String(action._names[nameIdx].c_str() + 2), messages)) {
if (!talk._talkToAbort)
printed = true;
@@ -2618,7 +2619,7 @@ void UserInterface::checkAction(ActionType &action, const char *const messages[]
}
for (int nameIdx = 0; nameIdx < 4; ++nameIdx) {
- if (action._names[nameIdx].hasPrefix("*")) {
+ if (action._names[nameIdx].hasPrefix("*") && action._names[nameIdx].size() >= 2) {
char ch = toupper(action._names[nameIdx][1]);
if (ch == 'T' || ch == 'B') {
@@ -2648,7 +2649,8 @@ void UserInterface::checkAction(ActionType &action, const char *const messages[]
}
for (int nameIdx = 0; nameIdx < 4; ++nameIdx) {
- if (action._names[nameIdx].hasPrefix("*") && toupper(action._names[nameIdx][1]) == 'F') {
+ if (action._names[nameIdx].hasPrefix("*") && action._names[nameIdx].size() >= 2
+ && toupper(action._names[nameIdx][1]) == 'F') {
if (obj.checkNameForCodes(action._names[nameIdx].c_str() + 2, messages)) {
if (!talk._talkToAbort)
printed = true;