mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-08-19 02:42:23 +08:00
Do not use !str for checking wxString emptiness
While wxString::operator!() is a documented alternative to .empty() since 25 years, using it in just a handful of places in the codebase is not consistent. !str is arguably not very readable either, because std::string does not have such an operator, and neither does e.g. Qt's QString. People would generally except ! in the context of any kind of strings to check for null pointer (char*), or an optional with a missing value (std::optional).
This commit is contained in:
@@ -930,7 +930,7 @@ void TextWidgetsPage::OnButtonLoad(wxCommandEvent& WXUNUSED(event))
|
||||
pathlist.Add("../../../samples/widgets");
|
||||
|
||||
wxString filename = pathlist.FindValidPath("textctrl.cpp");
|
||||
if ( !filename )
|
||||
if ( filename.empty() )
|
||||
{
|
||||
wxLogError("File textctrl.cpp not found.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user