From 1574e0bbd17e70feb1f7c88c2ba6d752319f3f5c Mon Sep 17 00:00:00 2001 From: firleju Date: Fri, 4 Aug 2017 20:31:54 +0200 Subject: [PATCH] Fixed crach when speedtable has one position --- Driver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Driver.cpp b/Driver.cpp index 3c6e5638..cba674e6 100644 --- a/Driver.cpp +++ b/Driver.cpp @@ -1385,7 +1385,7 @@ void TController::TablePurger() void TController::TableSort() { TSpeedPos sp_temp = TSpeedPos(); // uzywany do przenoszenia - for (std::size_t i = 0; i < iLast - 1; i++) + for (std::size_t i = 0; i < (iLast - 1) && iLast > 0; i++) { // pętla tylko do dwóch pozycji od końca bo ostatniej nie modyfikujemy if (sSpeedTable[i].fDist > sSpeedTable[i + 1].fDist) { // jesli pozycja wcześniejsza jest dalej to źle