NDK/Console: Fix crash on empty history

This commit is contained in:
Lynix 2019-12-15 11:50:02 +01:00
parent 7e6dcdf740
commit 437f60dbd4
2 changed files with 7 additions and 0 deletions

View File

@ -304,6 +304,7 @@ Nazara Development Kit:
- Fixed PhysicsComponent2D copy not copying physics attributes - Fixed PhysicsComponent2D copy not copying physics attributes
- Added Entity::DropComponent which detaches a component without necessarily destroying it - Added Entity::DropComponent which detaches a component without necessarily destroying it
- ⚠ ConstraintComponent2D has been reworked to handle entity destruction and remove constraints at will - ⚠ ConstraintComponent2D has been reworked to handle entity destruction and remove constraints at will
- Fixed crash when pressing up/down key with no history in the console
# 0.4: # 0.4:

View File

@ -81,6 +81,9 @@ namespace Ndk
{ {
*ignoreDefaultAction = true; *ignoreDefaultAction = true;
if (m_commandHistory.empty())
return;
if (m_historyPosition > 0) if (m_historyPosition > 0)
m_historyPosition--; m_historyPosition--;
@ -91,6 +94,9 @@ namespace Ndk
{ {
*ignoreDefaultAction = true; *ignoreDefaultAction = true;
if (m_commandHistory.empty())
return;
if (++m_historyPosition >= m_commandHistory.size()) if (++m_historyPosition >= m_commandHistory.size())
m_historyPosition = 0; m_historyPosition = 0;