Fixed possible wrong index usage
This commit is contained in:
parent
bab4d633db
commit
4109968fed
@ -61,6 +61,9 @@ void TranslatorHelper::loadScripts () {
|
|||||||
void TranslatorHelper::newItem (bool forceRotate) {
|
void TranslatorHelper::newItem (bool forceRotate) {
|
||||||
triesLeft_ = scripts_.size ();
|
triesLeft_ = scripts_.size ();
|
||||||
currentIndex_ = forceRotate ? currentIndex_ + 1 : 0;
|
currentIndex_ = forceRotate ? currentIndex_ + 1 : 0;
|
||||||
|
if (currentIndex_ >= scripts_.size ()) {
|
||||||
|
currentIndex_ = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TranslatorHelper::nextScript () {
|
QString TranslatorHelper::nextScript () {
|
||||||
@ -74,7 +77,10 @@ QString TranslatorHelper::nextScript () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString TranslatorHelper::currentScript () const {
|
QString TranslatorHelper::currentScript () const {
|
||||||
return (triesLeft_ > 0 ? scripts_.at (currentIndex_) : QString ());
|
if (triesLeft_ > 0 && currentIndex_ < scripts_.size ()) {
|
||||||
|
return scripts_.at (currentIndex_);
|
||||||
|
}
|
||||||
|
return QString ();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TranslatorHelper::gotScripts () const {
|
bool TranslatorHelper::gotScripts () const {
|
||||||
|
Loading…
Reference in New Issue
Block a user