Fix owner info NPEs

This commit is contained in:
crschnick 2024-08-28 23:10:30 +00:00
parent 2831e8372a
commit 3a700643f0
2 changed files with 8 additions and 4 deletions

View file

@ -189,10 +189,10 @@ public final class BrowserFileListComp extends SimpleComp {
var m = fileList.getFileSystemModel();
var user = unix.getUser() != null
? unix.getUser()
: m.getCache().getUsers().get(unix.getUid());
: m.getCache().getUsers().getOrDefault(unix.getUid(), "?");
var group = unix.getGroup() != null
? unix.getGroup()
: m.getCache().getGroups().get(unix.getGid());
: m.getCache().getGroups().getOrDefault(unix.getGid(), "?");
var uid = String.valueOf(
unix.getUid() != null ? unix.getUid() : m.getCache().getUidForUser(user));
var gid = String.valueOf(

View file

@ -58,7 +58,9 @@ public class OpenFileSystemCache extends ShellControlCache {
.orElse("");
lines.lines().forEach(s -> {
var split = s.split(":");
try {
users.putIfAbsent(Integer.parseInt(split[2]), split[0]);
} catch (NumberFormatException ignored) {}
});
if (users.isEmpty()) {
@ -77,7 +79,9 @@ public class OpenFileSystemCache extends ShellControlCache {
.orElse("");
lines.lines().forEach(s -> {
var split = s.split(":");
try {
groups.putIfAbsent(Integer.parseInt(split[2]), split[0]);
} catch (NumberFormatException ignored) {}
});
if (groups.isEmpty()) {