diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2006-06-06 15:28:20 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2006-06-06 15:28:20 +0000 |
| commit | aa9148eea84ae393645104fbfc8e0d3cd6e5f873 (patch) | |
| tree | fd1f42d48c2aa0bec7b01ee90e1aefcc352f5fab /src | |
| parent | 30786c2ed39ef0e8482b48b6663ffd99fb032ddd (diff) | |
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
Diffstat (limited to 'src')
| -rw-r--r-- | src/fl_font_mac.cxx | 5 |
1 files changed, 5 insertions, 0 deletions
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); |
