Skip to content

Commit 4c6fe2c

Browse files
committed
showing error when icon is not found
1 parent 1f86f48 commit 4c6fe2c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

bonnet/bonnet.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ static void change_icon(HWND hwnd, const std::string& iconPath)
5959
LR_DEFAULTSIZE | // default metrics based on the type (IMAGE_ICON, 32x32)
6060
LR_SHARED // let the system release the handle when it's no longer used
6161
));
62+
if (!icon)
63+
{
64+
throw std::runtime_error(std::format("icon not found: '{}'", iconPath));
65+
}
6266
}
6367

6468
SendMessage(hwnd, WM_SETICON, ICON_SMALL, reinterpret_cast<LPARAM>(icon));
@@ -168,7 +172,7 @@ void bonnet::launcher::launch_with_args(int argc, char** argv, std::function<voi
168172
}
169173
catch (const std::exception& ex)
170174
{
171-
throw std::runtime_error(std::string("Error configuring bonnet: ") + ex.what() + "\n\n" + cmd_line_options.help());
175+
throw std::runtime_error(std::format("Error configuring bonnet: {}\n\n{}", ex.what(), cmd_line_options.help()));
172176
}
173177

174178
launch_with_config(bonnet_conf);

0 commit comments

Comments
 (0)