1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-05-13 22:06:58 +02:00

Check input destination position when moving using arrow keys

This one fix crash I reported in 2085
This commit is contained in:
ArseniyShestakov 2015-02-22 10:05:24 +03:00
parent a6ce45e867
commit 00de870f17

View File

@ -1192,7 +1192,8 @@ void CAdvMapInt::keyPressed(const SDL_KeyboardEvent & key)
CGPath &path = LOCPLINT->paths[h];
terrain.currentPath = &path;
if(!LOCPLINT->cb->getPathsInfo(h)->getPath(h->getPosition(false) + dir, path))
int3 dst = h->getPosition(false) + dir;
if(dst != verifyPos(dst) || !LOCPLINT->cb->getPathsInfo(h)->getPath(dst, path))
{
terrain.currentPath = nullptr;
return;