diff options
author | Vsevolod Kukol <sevo@sevo.org> | 2014-08-22 12:51:12 +0400 |
---|---|---|
committer | Vsevolod Kukol <sevo@sevo.org> | 2014-08-22 12:51:12 +0400 |
commit | 912b2d9cab8dfee81a43b0cb3432ef04ca80314a (patch) | |
tree | 363fdd5b289cddb2aaaf9b927b31442f376841cd /Xwt.WPF | |
parent | 4140af5fd6f96edb4d710a956d98ea9dcb5a6630 (diff) |
add null check for text in TextLayoutBackend
the text should never be null, because the toolkits require
a string value, when drawing. Otherwise WPF and MAC
throw a NullReferenceException and Gtk prints
a warning to the console (Pango-CRITICAL).
Diffstat (limited to 'Xwt.WPF')
-rw-r--r-- | Xwt.WPF/Xwt.WPFBackend/TextLayoutBackendHandler.cs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Xwt.WPF/Xwt.WPFBackend/TextLayoutBackendHandler.cs b/Xwt.WPF/Xwt.WPFBackend/TextLayoutBackendHandler.cs index ca422b9d..229ee2a9 100644 --- a/Xwt.WPF/Xwt.WPFBackend/TextLayoutBackendHandler.cs +++ b/Xwt.WPF/Xwt.WPFBackend/TextLayoutBackendHandler.cs @@ -112,7 +112,7 @@ namespace Xwt.WPFBackend SolidColorBrush brush = System.Windows.Media.Brushes.Black; double width; double height; - string text = null; + string text = String.Empty; Xwt.Drawing.TextTrimming? textTrimming; bool needsRebuild; @@ -160,7 +160,7 @@ namespace Xwt.WPFBackend { if (this.text != text) { - this.text = text; + this.text = text ?? String.Empty; needsRebuild = true; } } |