@@ -158,6 +158,10 @@ public boolean isVerified() throws NamelessException {
158158 * @return True if the user is member of at least one staff group, otherwise false
159159 */
160160 public boolean isStaff () throws NamelessException {
161+ if (!this .userInfo ().has ("groups" )) {
162+ throw new IllegalStateException ("Groups array missing: https://github.com/NamelessMC/Nameless/issues/3052" );
163+ }
164+
161165 JsonArray groups = this .userInfo ().getAsJsonArray ("groups" );
162166 for (JsonElement elem : groups ) {
163167 JsonObject group = elem .getAsJsonObject ();
@@ -173,6 +177,9 @@ public boolean isStaff() throws NamelessException {
173177 * @return List of the user's groups, sorted from low order to high order.
174178 */
175179 public @ NonNull List <@ NonNull Group > groups () throws NamelessException {
180+ if (!this .userInfo ().has ("groups" )) {
181+ throw new IllegalStateException ("Groups array missing: https://github.com/NamelessMC/Nameless/issues/3052" );
182+ }
176183 return GsonHelper .toObjectList (this .userInfo ().getAsJsonArray ("groups" ), Group ::new );
177184 }
178185
@@ -184,6 +191,9 @@ public boolean isStaff() throws NamelessException {
184191 * @return Player's group with the lowest order
185192 */
186193 public @ Nullable Group primaryGroup () throws NamelessException {
194+ if (!this .userInfo ().has ("groups" )) {
195+ throw new IllegalStateException ("Groups array missing: https://github.com/NamelessMC/Nameless/issues/3052" );
196+ }
187197 final JsonArray groups = this .userInfo ().getAsJsonArray ("groups" );
188198 if (groups .size () > 0 ) {
189199 // Website group response is ordered, first group is primary group.
0 commit comments