set errno to 0 before strtoul call

This commit is contained in:
Daniel Micay 2012-09-28 13:54:10 -04:00
parent eb6389e042
commit 4bd4bff004
1 changed files with 1 additions and 1 deletions

View File

@ -134,7 +134,6 @@ static void find_urls(VteTerminal *vte, search_panel_info *panel_info) {
static void launch_url(const char *text, search_panel_info *info) {
char *end;
errno = 0;
std::unique_ptr<char, decltype(&free)> copy(strdup(text), free);
for (char *s_ptr = copy.get(), *saveptr; ; s_ptr = nullptr) {
@ -143,6 +142,7 @@ static void launch_url(const char *text, search_panel_info *info) {
break;
}
errno = 0;
unsigned long id = strtoul(token, &end, 10);
if (!errno && end != text && id && id <= info->url_list.size()) {
launch_browser(info->url_list[id - 1].url.get());