aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/engine/kgraphics.cpp3
-rw-r--r--engines/sci/engine/kpathing.cpp2
-rw-r--r--engines/sci/graphics/font.cpp2
3 files changed, 4 insertions, 3 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 07385fd3f9..9ef2025337 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -351,7 +351,8 @@ reg_t kTextSize(EngineState *s, int argc, reg_t *argv) {
dest[0] = dest[1] = NULL_REG;
if (text.empty() || !dest) { // Empty text
- dest[2] = dest[3] = make_reg(0, 0);
+ if (dest)
+ dest[2] = dest[3] = make_reg(0, 0);
debugC(2, kDebugLevelStrings, "GetTextSize: Empty string");
return s->r_acc;
}
diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp
index faf966af92..4ea28ed903 100644
--- a/engines/sci/engine/kpathing.cpp
+++ b/engines/sci/engine/kpathing.cpp
@@ -1312,7 +1312,7 @@ static void AStar(PathfindingState *s) {
}
// Check if we are done
- if (vertex_min == s->vertex_end)
+ if (vertex_min == s->vertex_end || !vertex_min)
break;
// Move vertex from set open to set closed
diff --git a/engines/sci/graphics/font.cpp b/engines/sci/graphics/font.cpp
index 852771d081..f06dbea05e 100644
--- a/engines/sci/graphics/font.cpp
+++ b/engines/sci/graphics/font.cpp
@@ -88,7 +88,7 @@ void GfxFontFromResource::draw(uint16 chr, int16 top, int16 left, byte color, bo
byte *pIn = getCharData(chr);
for (int i = 0; i < charHeight; i++, y++) {
if (greyedOutput)
- mask = greyedTop++ % 2 ? 0xAA : 0x55;
+ mask = ((greyedTop++) % 2) ? 0xAA : 0x55;
for (int done = 0; done < charWidth; done++) {
if ((done & 7) == 0) // fetching next data byte
b = *(pIn++) & mask;