aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32/PlatWin.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'win32/PlatWin.cxx')
-rw-r--r--win32/PlatWin.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 4eb1e2b47..2eb2d12f0 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -516,7 +516,11 @@ void Surface::MeasureWidths(Font &font_, const char *s, int len, int *positions)
}
positions[i] = sz.cx;
} else {
- ::GetTextExtentExPoint(hdc, s, len, 30000, &fit, positions, &sz);
+ if (!::GetTextExtentExPoint(hdc, s, len, 30000, &fit, positions, &sz)) {
+ // Eeek - a NULL DC or other foolishness could cause this.
+ // The least we can do is set the positions to zero!
+ memset(positions, 0, len * sizeof(*positions));
+ }
}
}