From 05a9bc2fa1543c583d231953c8619f079a072639 Mon Sep 17 00:00:00 2001 From: NovaFox161 Date: Wed, 1 Dec 2021 14:50:17 -0600 Subject: [PATCH] Hotfix sql query due to empty list --- .../dreamexposure/discal/core/database/DatabaseManager.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/main/kotlin/org/dreamexposure/discal/core/database/DatabaseManager.kt b/core/src/main/kotlin/org/dreamexposure/discal/core/database/DatabaseManager.kt index a52b06b96..ffddbdd84 100644 --- a/core/src/main/kotlin/org/dreamexposure/discal/core/database/DatabaseManager.kt +++ b/core/src/main/kotlin/org/dreamexposure/discal/core/database/DatabaseManager.kt @@ -1360,6 +1360,8 @@ object DatabaseManager { if (!idsToUse.contains(id)) idsToUse.add(id) } + if (idsToUse.isEmpty()) return Mono.just(emptyMap()) + // Convert our list of IDs to sql escaped string val builder = StringBuilder() idsToUse.withIndex().forEach { @@ -1391,7 +1393,9 @@ object DatabaseManager { LOGGER.error(DEFAULT, "Failed to get many event data", it) }.onErrorResume { Mono.empty() - }.collectMap { it.eventId } + }.collectMap { + it.eventId + }.defaultIfEmpty(emptyMap()) } } }