From 67cbb040514faed399bd32a12c9e0bee1e793a6c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 31 Jan 2014 16:06:43 +0000 Subject: [PATCH] Try to detect invalid wxHtmlWindow title format earlier. Assert directly in wxHtmlWindow::SetRelatedFrame() instead of doing it much later, hopefully people will read the comment at the assert point. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75748 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/html/htmlwin.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/html/htmlwin.cpp b/src/html/htmlwin.cpp index a6ae16e7b3..ac7346326e 100644 --- a/src/html/htmlwin.cpp +++ b/src/html/htmlwin.cpp @@ -380,6 +380,14 @@ void wxHtmlWindow::SetRelatedFrame(wxFrame* frame, const wxString& format) { m_RelatedFrame = frame; m_TitleFormat = format; + + // Check if the format provided can actually be used: it's more + // user-friendly to do it here and now rather than triggering the same + // assert much later when it's really used. + + // If you get an assert here, it means that the title doesn't contain + // exactly one "%s" format specifier, which is an error in the caller. + wxString::Format(m_TitleFormat, wxString()); }