From 11d65763ce56d6b78b702ff419275e109a4e3622 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Fri, 29 May 2015 00:09:47 +0800 Subject: [PATCH] fix a crash when the size of a label is empty and '\t' is contained --- source/gui/detail/window_layout.cpp | 3 +++ source/paint/detail/native_paint_interface.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/source/gui/detail/window_layout.cpp b/source/gui/detail/window_layout.cpp index 99ab04ab..a77eff5f 100644 --- a/source/gui/detail/window_layout.cpp +++ b/source/gui/detail/window_layout.cpp @@ -24,6 +24,9 @@ namespace nana //class window_layout void window_layout::paint(core_window_t* wd, bool is_redraw, bool is_child_refreshed) { + if (wd->drawer.graphics.empty()) + return; + if (nullptr == wd->effect.bground) { if (is_redraw) diff --git a/source/paint/detail/native_paint_interface.cpp b/source/paint/detail/native_paint_interface.cpp index 7c96f7b6..584ff3dc 100644 --- a/source/paint/detail/native_paint_interface.cpp +++ b/source/paint/detail/native_paint_interface.cpp @@ -156,6 +156,9 @@ namespace detail nana::size text_extent_size(drawable_type dw, const nana::char_t * text, std::size_t len) { + if (nullptr == dw || nullptr == text || 0 == len) + return{}; + nana::size extents = raw_text_extent_size(dw, text, len); const nana::char_t* const end = text + len;