From 45bb9f4318fc006aaf593acea216dd0b70b1635d Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Sun, 14 Apr 2019 23:31:08 +0200 Subject: [PATCH] \todo introduce a place::implement::field_gather::error ?? --- source/gui/place.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/source/gui/place.cpp b/source/gui/place.cpp index c6de0c14..88c76bca 100644 --- a/source/gui/place.cpp +++ b/source/gui/place.cpp @@ -490,8 +490,7 @@ namespace nana { return (vert ? pos.y : pos.x); } - - + static bool is_idchar(int ch) noexcept { return ('_' == ch || std::isalnum(ch)); @@ -499,6 +498,7 @@ namespace nana static std::size_t find_idstr(const std::string& text, const char* idstr, std::size_t off = 0) { + if (!idstr) return text.npos; /// ?? const auto len = std::strlen(idstr); size_t pos; @@ -652,6 +652,8 @@ namespace nana : public place::field_interface { public: + + /// \todo introduce a place::implement::field_gather::error ?? struct element_t { window handle; @@ -701,13 +703,13 @@ namespace nana return nullptr; } private: - void _m_insert_widget(window wd, bool to_fasten) + void _m_insert_widget(window wd, bool to_fasten) /// \todo better errors caption of failed windows, field { if (API::empty_window(wd)) - throw std::invalid_argument("Place: An invalid window handle."); + throw place::error("Failed to insert an invalid window handle.", *place_ptr_); if (API::get_parent_window(wd) != place_ptr_->window_handle()) - throw std::invalid_argument("Place: the window is not a child of place bind window"); + throw place::error("Failed to insert a window which is not a child of the place-binded window", *place_ptr_); //Listen to destroy of a window //It will delete the element and recollocate when the window destroyed.