1
0
Fork 0

Tweak permitted indices for GPS route insert commands.

This commit is contained in:
jmt 2009-10-21 07:18:36 +00:00 committed by Tim Moore
parent 2a86384da7
commit 08039f1fa5

View file

@ -1290,7 +1290,7 @@ void GPS::setCommand(const char* aCmd)
defineWaypoint();
} else if (!strcmp(aCmd, "route-insert-before")) {
int index = _scratchNode->getIntValue("index");
if (index < 0) {
if (index < 0 || (_routeMgr->size() == 0)) {
index = _routeMgr->size();
} else if (index >= _routeMgr->size()) {
SG_LOG(SG_INSTR, SG_WARN, "GPS:route-insert-before, bad index:" << index);
@ -1300,7 +1300,7 @@ void GPS::setCommand(const char* aCmd)
insertWaypointAtIndex(index);
} else if (!strcmp(aCmd, "route-insert-after")) {
int index = _scratchNode->getIntValue("index");
if (index < 0) {
if (index < 0 || (_routeMgr->size() == 0)) {
index = _routeMgr->size();
} else if (index >= _routeMgr->size()) {
SG_LOG(SG_INSTR, SG_WARN, "GPS:route-insert-after, bad index:" << index);