Verified Commit 88b4415d authored by Romain De Laage De Bellefaye's avatar Romain De Laage De Bellefaye 🌳
Browse files

Add error message when no previous state available

parent e9ddfb09
Pipeline #79686 passed with stage
in 15 seconds
......@@ -94,9 +94,12 @@ class Automate {
/// Se placer sur l'état précédent si disponible
void previous() {
if(itBuffer!=buffer.begin())
if(itBuffer!=buffer.begin()) {
itBuffer--;
AutoCell::getInstance().afficherGrille(&*itBuffer);
AutoCell::getInstance().afficherGrille(&*itBuffer);
}
else
throw "No more state available before in the buffer (max: 15)";
}
/// Se placer sur l'état suivant si disponible
void next() { if(itBuffer!=(--buffer.end())) itBuffer++; }
......
......@@ -407,5 +407,12 @@ void AutoCell::next() {
}
void AutoCell::previous() {
Automate::getInstance().previous();
try {
Automate::getInstance().previous();
}
catch (const char* m)
{
QString msg(m);
afficherErreur(msg);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment