mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 02:09:35 +02:00
a workaround to fix an exception in initTOC
This commit is contained in:
parent
85a23bc67a
commit
297f9aa6f9
2 changed files with 35 additions and 32 deletions
|
@ -255,8 +255,7 @@ JNIEXPORT jboolean JNICALL Java_org_geometerplus_fbreader_formats_NativeFormatPl
|
||||||
}
|
}
|
||||||
model->flush();
|
model->flush();
|
||||||
|
|
||||||
if (!initInternalHyperlinks(env, javaModel, *model) ||
|
if (!initInternalHyperlinks(env, javaModel, *model) || !initTOC(env, javaModel, *model)) {
|
||||||
!initTOC(env, javaModel, *model)) {
|
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ public class NativeBookModel extends BookModelImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initTOC(ZLTextModel contentsModel, int[] childrenNumbers, int[] referenceNumbers) {
|
public void initTOC(ZLTextModel contentsModel, int[] childrenNumbers, int[] referenceNumbers) {
|
||||||
|
try {
|
||||||
final StringBuilder buffer = new StringBuilder();
|
final StringBuilder buffer = new StringBuilder();
|
||||||
|
|
||||||
final ArrayList<Integer> positions = new ArrayList<Integer>();
|
final ArrayList<Integer> positions = new ArrayList<Integer>();
|
||||||
|
@ -70,6 +71,9 @@ public class NativeBookModel extends BookModelImpl {
|
||||||
positions.remove(lastIndex);
|
positions.remove(lastIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
if (tree != TOCTree || positions.size() > 0) {
|
if (tree != TOCTree || positions.size() > 0) {
|
||||||
throw new RuntimeException("Invalid state after TOC building:\n"
|
throw new RuntimeException("Invalid state after TOC building:\n"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue