From aa9148eea84ae393645104fbfc8e0d3cd6e5f873 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Tue, 6 Jun 2006 15:28:20 +0000 Subject: Added check for NULL for numbnuts (like me) who query the size of a font before choosing a font... . git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5179 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/fl_font_mac.cxx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/fl_font_mac.cxx b/src/fl_font_mac.cxx index e6edecbaa..1bbd379fc 100644 --- a/src/fl_font_mac.cxx +++ b/src/fl_font_mac.cxx @@ -292,6 +292,11 @@ double fl_width(const char* txt, int n) { // The result should be the same. } } + if (!fl_fontsize) { + fl_font(0, 12); // avoid a crash! + if (!fl_fontsize) + return 0.0; // user must select a font first! + } OSStatus err; // convert to UTF-16 first UniChar *uniStr = fl_macToUtf16(txt, n); -- cgit v1.2.3