Avoid negative initial coordinates

Fixes #3111
This commit is contained in:
Maxime Coste 2019-10-03 21:18:51 +10:00
parent d793ca76b6
commit 2f1be14b5f

View File

@ -1072,12 +1072,12 @@ int main(int argc, char* argv[])
auto colon = find(name, ':'); auto colon = find(name, ':');
if (auto line = str_to_int_ifp({name.begin()+1, colon})) if (auto line = str_to_int_ifp({name.begin()+1, colon}))
{ {
init_coord = BufferCoord{ init_coord = std::max<BufferCoord>({0,0}, {
*line - 1, *line - 1,
colon != name.end() ? colon != name.end() ?
str_to_int_ifp({colon+1, name.end()}).value_or(1) - 1 str_to_int_ifp({colon+1, name.end()}).value_or(1) - 1
: 0 : 0
}; });
continue; continue;
} }
} }