Commit 118f951b authored by Chen Bill's avatar Chen Bill Committed by GitHub

set errno before strtol (#2705)

parent 9d4496f7
...@@ -197,6 +197,7 @@ int DeckManager::LoadDeck(Deck& deck, std::istringstream& deckStream, bool is_pa ...@@ -197,6 +197,7 @@ int DeckManager::LoadDeck(Deck& deck, std::istringstream& deckStream, bool is_pa
} }
if (linebuf[0] < '0' || linebuf[0] > '9') if (linebuf[0] < '0' || linebuf[0] > '9')
continue; continue;
errno = 0;
code = strtol(linebuf.c_str(), nullptr, 10); code = strtol(linebuf.c_str(), nullptr, 10);
if (errno == ERANGE) if (errno == ERANGE)
continue; continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment