mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-22 15:40:23 +00:00
Fix NPE
This commit is contained in:
parent
33ca8cca9c
commit
8b695c7ba2
2 changed files with 7 additions and 3 deletions
|
@ -19,6 +19,6 @@ public class LaunchExchangeImpl extends LaunchExchange
|
|||
return Response.builder().command(List.of(split.toStrings())).build();
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException("Not launchable");
|
||||
throw new IllegalArgumentException(store.getName() + " is not launchable");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,15 +64,19 @@ public interface MessageExchangeImpl<RQ extends RequestMessage, RS extends Respo
|
|||
return store.get();
|
||||
}
|
||||
|
||||
default DataStoreEntry getStoreEntryById(@NonNull DataStoreId id, boolean acceptDisabled) throws ClientException {
|
||||
default DataStoreEntry getStoreEntryById(@NonNull DataStoreId id, boolean acceptUnusable) throws ClientException {
|
||||
var store = DataStorage.get().getStoreEntryIfPresent(id);
|
||||
if (store.isEmpty()) {
|
||||
throw new ClientException("No store with id " + id + " was found");
|
||||
}
|
||||
if (store.get().isDisabled() && !acceptDisabled) {
|
||||
if (store.get().isDisabled() && !acceptUnusable) {
|
||||
throw new ClientException(
|
||||
String.format("Store %s is disabled", store.get().getName()));
|
||||
}
|
||||
if (!store.get().getState().isUsable() && !acceptUnusable) {
|
||||
throw new ClientException(
|
||||
String.format("Store %s is not completely configured", store.get().getName()));
|
||||
}
|
||||
return store.get();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue