summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorFlorian Zschocke <f.zschocke+git@gmail.com>2022-11-01 00:50:14 +0100
committerFlorian Zschocke <f.zschocke+git@gmail.com>2022-11-01 00:50:14 +0100
commit1c86273edb63f641064bca3a7d40f425e0da09ec (patch)
tree15fbd5f0f58f796386a02d6f60119dbeff133871 /src/main
parent0ca5cf292fd1c6c02a2a24734ad6612ecffd45d9 (diff)
downloadgitblit-1c86273edb63f641064bca3a7d40f425e0da09ec.tar.gz
gitblit-1c86273edb63f641064bca3a7d40f425e0da09ec.zip
authority: Fix null pointer crash for deleted users
When a user had a certificate, i.e. an entry in the Gitblit Authority database, but the user was deleted from the Gitblit database, then the Authority application crashes upon loading. This patch prevents the crash. The deleted user is no longer shown in the Authority. But the database entry still is kept. This should be improved to show deleted users and give the possibility to delete them from the Authority's database. This fixes #1359
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/gitblit/authority/GitblitAuthority.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/com/gitblit/authority/GitblitAuthority.java b/src/main/java/com/gitblit/authority/GitblitAuthority.java
index 15c23a79..34931bb5 100644
--- a/src/main/java/com/gitblit/authority/GitblitAuthority.java
+++ b/src/main/java/com/gitblit/authority/GitblitAuthority.java
@@ -299,7 +299,11 @@ public class GitblitAuthority extends JFrame implements X509Log {
List<UserCertificateModel> list = UserCertificateConfig.KEY.parse(config).list;
for (UserCertificateModel ucm : list) {
ucm.user = userService.getUserModel(ucm.user.username);
- map.put(ucm.user.username, ucm);
+ // Users may have been deleted, but are still present in authority.conf.
+ // TODO: Currently this only keeps the app from crashing. It should provide means to show obsolete user entries and delete them.
+ if (ucm.user != null) {
+ map.put(ucm.user.username, ucm);
+ }
}
} catch (IOException e) {
e.printStackTrace();