Skip to content

Commit 7d0371f

Browse files
committed
fixed NPE when no images exist
1 parent f2c70e4 commit 7d0371f

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/main/java/de/sub/goobi/helper/FilesystemHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public static boolean isOcrFileExists(Process inProcess, String ocrFile) {
188188
StorageProviderInterface sp = StorageProvider.getInstance();
189189
return sp.isFileExists(xml) || sp.isFileExists(txt) || sp.isFileExists(alto);
190190
}
191-
} catch (SwapException | IOException e) {
191+
} catch (SwapException | IOException | NullPointerException e) {
192192
return false;
193193
}
194194
}

src/main/java/de/sub/goobi/metadaten/Metadaten.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3605,6 +3605,9 @@ public String SeitenWeg() {
36053605
*/
36063606

36073607
public boolean isImageHasOcr() {
3608+
if (image == null || StringUtils.isBlank(image.getTooltip())) {
3609+
return false;
3610+
}
36083611
return FilesystemHelper.isOcrFileExists(myProzess, image.getTooltip().substring(0, image.getTooltip().lastIndexOf(".")));
36093612
}
36103613

0 commit comments

Comments
 (0)