diff options
Diffstat (limited to 'win32/PlatWin.cxx')
-rw-r--r-- | win32/PlatWin.cxx | 6 |
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)); + } } } |