mirror of https://github.com/kiwix/libkiwix.git
Correctly pre-increment loopCounter.
If we check the later the `loopCounter` with 42, we must pre-increment the content. Else, in case of infinite loop, the `loopCounter` will be 43. Related to kiwix/kiwix-tools#168
This commit is contained in:
parent
e23949a9fa
commit
313f6731b0
|
@ -255,7 +255,7 @@ JNIEXPORT jbyteArray JNICALL Java_org_kiwix_kiwixlib_JNIKiwixReader_getContentPa
|
|||
return data;
|
||||
}
|
||||
int loopCounter = 0;
|
||||
while (article.isRedirect() && loopCounter++ < 42) {
|
||||
while (article.isRedirect() && ++loopCounter < 42) {
|
||||
article = article.getRedirectArticle();
|
||||
}
|
||||
if (loopCounter == 42) {
|
||||
|
@ -294,7 +294,7 @@ Java_org_kiwix_kiwixlib_JNIKiwixReader_getDirectAccessInformation(
|
|||
return pair;
|
||||
}
|
||||
int loopCounter = 0;
|
||||
while (article.isRedirect() && loopCounter++ < 42) {
|
||||
while (article.isRedirect() && ++loopCounter < 42) {
|
||||
article = article.getRedirectArticle();
|
||||
}
|
||||
if (loopCounter == 42) {
|
||||
|
|
Loading…
Reference in New Issue