From 349001c4001c42c9bebca10ffc85aeab45707432 Mon Sep 17 00:00:00 2001 From: Daniil Palagin Date: Tue, 1 Oct 2024 16:40:19 +0200 Subject: [PATCH] [kbss-cvut/record-manager-ui#202] Fix the bug while loading all users http-nio-8080-exec-7] WARN o.s.w.s.m.s.DefaultHandlerExceptionResolver - Resolved [org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: Cannot invoke "cz.cvut.kbss.study.model.RoleGroup.getRoles()" because "this.roleGroup" is null] --- src/main/java/cz/cvut/kbss/study/model/User.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/cz/cvut/kbss/study/model/User.java b/src/main/java/cz/cvut/kbss/study/model/User.java index dd44586d..c8c55538 100644 --- a/src/main/java/cz/cvut/kbss/study/model/User.java +++ b/src/main/java/cz/cvut/kbss/study/model/User.java @@ -148,7 +148,7 @@ public void setRoleGroup(RoleGroup roleGroup) { * @return {@code true} if this is admin, {@code false} otherwise */ public boolean isAdmin() { - return roleGroup.getRoles().contains(Role.administrator); + return roleGroup != null && roleGroup.getRoles().contains(Role.administrator); } public String getToken() {