diff options
author | George Hazan <george.hazan@gmail.com> | 2023-08-08 13:20:37 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-08-08 13:20:37 +0300 |
commit | f078945343dd99ff5bb83836bc87d77f1a85d32d (patch) | |
tree | 41ec28d482c766b2b76ed1849d7f6915b427b3dd /libs/mTextControl | |
parent | 6eefc00f1c0eef87ec758eb2f1b885d3361beb1c (diff) |
occasional crash fix
Diffstat (limited to 'libs/mTextControl')
-rw-r--r-- | libs/mTextControl/src/services.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libs/mTextControl/src/services.cpp b/libs/mTextControl/src/services.cpp index b38ef88367..310c2863dd 100644 --- a/libs/mTextControl/src/services.cpp +++ b/libs/mTextControl/src/services.cpp @@ -115,7 +115,8 @@ MTEXTCONTROL_DLL(TextObject *) MTextCreateEx(HANDLE userHandle, void *text, uint MTEXTCONTROL_DLL(int) MTextMeasure(HDC dc, SIZE *sz, TextObject *text) { - if (!text) return 0; + if (!text || !dc) + return 0; long lWidth = sz->cx, lHeight = sz->cy; text->ftd->get_NaturalSize(dc, &lWidth, &lHeight); @@ -129,7 +130,8 @@ MTEXTCONTROL_DLL(int) MTextMeasure(HDC dc, SIZE *sz, TextObject *text) MTEXTCONTROL_DLL(int) MTextDisplay(HDC dc, POINT pos, SIZE sz, TextObject *text) { - if (!text) return 0; + if (!text || !dc) + return 0; COLORREF cl = GetTextColor(dc); |