Fixes an exception encountered when importing a text file as a book
All checks were successful
EpicKnarvik97/Books-Without-Borders/pipeline/head This commit looks good
All checks were successful
EpicKnarvik97/Books-Without-Borders/pipeline/head This commit looks good
This commit is contained in:
@@ -95,8 +95,11 @@ public final class BookFormatter {
|
|||||||
*/
|
*/
|
||||||
public static void formatLastPageAddNewline(@NotNull List<String> rawPages, int fitsNewline) {
|
public static void formatLastPageAddNewline(@NotNull List<String> rawPages, int fitsNewline) {
|
||||||
int pageIndex = rawPages.size() - 1;
|
int pageIndex = rawPages.size() - 1;
|
||||||
if (rawPages.get(pageIndex).length() <= fitsNewline && !rawPages.get(pageIndex).isEmpty()) {
|
String pageContents = rawPages.get(pageIndex);
|
||||||
rawPages.set(pageIndex, (rawPages.get(pageIndex)) + "\n");
|
if (pageContents == null) {
|
||||||
|
rawPages.set(pageIndex, "");
|
||||||
|
} else if (pageContents.length() <= fitsNewline && !pageContents.isEmpty()) {
|
||||||
|
rawPages.set(pageIndex, pageContents + "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user