aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32/PlatWin.cxx
diff options
context:
space:
mode:
authornyamatongwe <unknown>2000-09-07 23:56:41 +0000
committernyamatongwe <unknown>2000-09-07 23:56:41 +0000
commit7da4b720fe573e150b8476d181330d1a7014e526 (patch)
tree161bfbc99812bf0773fee8c7a0018586ae2e9aaf /win32/PlatWin.cxx
parent0197776bc8d55c49a6e608a35525714814fc4fcc (diff)
downloadscintilla-mirror-7da4b720fe573e150b8476d181330d1a7014e526.tar.gz
Incorporated Mark's patch to handle failing GetTextExtentExPoint.
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));
+ }
}
}