Huw Davies : gdi32/tests: Prevent a crash if the shell dlg font is not found.
Alexandre Julliard
julliard at winehq.org
Wed Apr 5 16:17:07 CDT 2017
Module: wine
Branch: master
Commit: 8dc039a7d150cc9f2f815ffe19542195dcb5ea03
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8dc039a7d150cc9f2f815ffe19542195dcb5ea03
Author: Huw Davies <huw at codeweavers.com>
Date: Wed Apr 5 09:35:07 2017 +0100
gdi32/tests: Prevent a crash if the shell dlg font is not found.
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdi32/tests/font.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index fb27f8e..0b8cfd5 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -5305,10 +5305,13 @@ static void test_EnumFonts_subst(void)
ret = EnumFontFamiliesExA(hdc, &lf, enum_ms_shell_dlg_proc, (LPARAM)&efnd, 0);
ok(!ret, "MS Shell Dlg should be enumerated\n");
ok(efnd.total > 0, "MS Shell Dlg should be enumerated\n");
- ret = strcmp((const char *)efnd.elf[0].elfLogFont.lfFaceName, "MS Shell Dlg");
- ok(!ret, "expected MS Shell Dlg, got %s\n", efnd.elf[0].elfLogFont.lfFaceName);
- ret = strcmp((const char *)efnd.elf[0].elfFullName, "MS Shell Dlg");
- ok(ret, "did not expect MS Shell Dlg\n");
+ if (efnd.total)
+ {
+ ret = strcmp((const char *)efnd.elf[0].elfLogFont.lfFaceName, "MS Shell Dlg");
+ ok(!ret, "expected MS Shell Dlg, got %s\n", efnd.elf[0].elfLogFont.lfFaceName);
+ ret = strcmp((const char *)efnd.elf[0].elfFullName, "MS Shell Dlg");
+ ok(ret, "did not expect MS Shell Dlg\n");
+ }
efnd.total = 0;
ret = EnumFontFamiliesExA(hdc, NULL, enum_ms_shell_dlg2_proc, (LPARAM)&efnd, 0);
@@ -5320,10 +5323,13 @@ static void test_EnumFonts_subst(void)
ret = EnumFontFamiliesExA(hdc, &lf, enum_ms_shell_dlg2_proc, (LPARAM)&efnd, 0);
ok(!ret, "MS Shell Dlg 2 should be enumerated\n");
ok(efnd.total > 0, "MS Shell Dlg 2 should be enumerated\n");
- ret = strcmp((const char *)efnd.elf[0].elfLogFont.lfFaceName, "MS Shell Dlg 2");
- ok(!ret, "expected MS Shell Dlg 2, got %s\n", efnd.elf[0].elfLogFont.lfFaceName);
- ret = strcmp((const char *)efnd.elf[0].elfFullName, "MS Shell Dlg 2");
- ok(ret, "did not expect MS Shell Dlg 2\n");
+ if (efnd.total)
+ {
+ ret = strcmp((const char *)efnd.elf[0].elfLogFont.lfFaceName, "MS Shell Dlg 2");
+ ok(!ret, "expected MS Shell Dlg 2, got %s\n", efnd.elf[0].elfLogFont.lfFaceName);
+ ret = strcmp((const char *)efnd.elf[0].elfFullName, "MS Shell Dlg 2");
+ ok(ret, "did not expect MS Shell Dlg 2\n");
+ }
heap_free(efnd.elf);
DeleteDC(hdc);
More information about the wine-cvs
mailing list