Skip to content

Commit ae595bc

Browse files
authored
Merge pull request #1475 from lowcoder-org/fix/null_settings_value
Fix issues when application settings has null values for category, description, icon and title
2 parents 2b0ff80 + 7b9568b commit ae595bc

File tree

1 file changed

+12
-12
lines changed
  • server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/application/model

1 file changed

+12
-12
lines changed

server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/application/model/Application.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@ public Mono<String> getCategory(ApplicationRecordService applicationRecordServic
172172
if (liveDSL == null || liveDSL.get("settings") == null) return "";
173173
Object settingsObject = liveDSL.get("settings");
174174
if (settingsObject instanceof Map) {
175-
@SuppressWarnings("unchecked")
176-
Map<String, Object> settings = (Map<String, Object>) liveDSL.get("settings");
177-
return (String) settings.get("category");
175+
Map<?, ?> settings = (Map<?, ?>) liveDSL.get("settings");
176+
Object category = settings.get("category");
177+
return (category != null & category instanceof String)?(String) category:"";
178178
} else {
179179
return "";
180180
}
@@ -186,9 +186,9 @@ public Mono<String> getTitle(ApplicationRecordService applicationRecordService)
186186
if (liveDSL == null || liveDSL.get("settings") == null) return "";
187187
Object settingsObject = liveDSL.get("settings");
188188
if (settingsObject instanceof Map) {
189-
@SuppressWarnings("unchecked")
190-
Map<String, Object> settings = (Map<String, Object>) liveDSL.get("settings");
191-
return (String) settings.get("title");
189+
Map<?, ?> settings = (Map<?, ?>) liveDSL.get("settings");
190+
Object title = settings.get("title");
191+
return (title != null & title instanceof String)?(String) title:"";
192192
} else {
193193
return "";
194194
}
@@ -200,9 +200,9 @@ public Mono<String> getDescription(ApplicationRecordService applicationRecordSer
200200
if (liveDSL == null || liveDSL.get("settings") == null) return "";
201201
Object settingsObject = liveDSL.get("settings");
202202
if (settingsObject instanceof Map) {
203-
@SuppressWarnings("unchecked")
204-
Map<String, Object> settings = (Map<String, Object>) liveDSL.get("settings");
205-
return (String) settings.get("description");
203+
Map<?, ?> settings = (Map<?, ?>) liveDSL.get("settings");
204+
Object description = settings.get("description");
205+
return (description != null & description instanceof String)?(String) description:"";
206206
} else {
207207
return "";
208208
}
@@ -215,9 +215,9 @@ public Mono<String> getIcon(ApplicationRecordService applicationRecordService) {
215215
if (liveDSL == null || liveDSL.get("settings") == null) return "";
216216
Object settingsObject = liveDSL.get("settings");
217217
if (settingsObject instanceof Map) {
218-
@SuppressWarnings("unchecked")
219-
Map<String, Object> settings = (Map<String, Object>) liveDSL.get("settings");
220-
return (String) settings.get("icon");
218+
Map<?, ?> settings = (Map<?, ?>) liveDSL.get("settings");
219+
Object icon = settings.get("icon");
220+
return (icon != null & icon instanceof String)?(String) icon:"";
221221
} else {
222222
return "";
223223
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy