Fix JOSM #22186: NPE in MapWithAIDataUtils#mergeDataSet

This is due to the localized message being null.

Signed-off-by: Taylor Smock <tsmock@fb.com>
pull/1/head
Taylor Smock 2022-07-05 07:23:03 -06:00
rodzic 48751b16ec
commit 7d7464f5da
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 625F6A74A3E4311A
1 zmienionych plików z 8 dodań i 6 usunięć

Wyświetl plik

@ -189,15 +189,17 @@ public final class MapWithAIDataUtils {
try {
original.mergeFrom(ds.join());
} catch (RuntimeException e) {
final String notificationMessage;
if (e.getCause() instanceof IllegalDataException) {
Notification notification = new Notification();
notification.setContent(tr("MapWithAI servers may be down."));
GuiHelper.runInEDT(notification::show);
notificationMessage = tr("MapWithAI servers may be down.");
} else if (!Utils.isBlank(e.getLocalizedMessage())) {
notificationMessage = e.getLocalizedMessage();
} else {
Notification notification = new Notification();
GuiHelper.runInEDT(() -> notification.setContent(e.getLocalizedMessage()));
GuiHelper.runInEDT(notification::show);
notificationMessage = e.getMessage();
}
Notification notification = new Notification();
GuiHelper.runInEDT(() -> notification.setContent(notificationMessage));
GuiHelper.runInEDT(notification::show);
}
}
}