mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Accept single values for jsonrpc requests where a list is expected
This commit is contained in:
parent
6c3106db5d
commit
8c661c23be
1 changed files with 8 additions and 3 deletions
|
@ -40,6 +40,7 @@ public interface JsonRpcLocalCommand extends JsonRpcCommand<Map<String, Object>>
|
|||
super(attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T get(String dest) {
|
||||
final T value = super.get(dest);
|
||||
if (value != null) {
|
||||
|
@ -52,9 +53,13 @@ public interface JsonRpcLocalCommand extends JsonRpcCommand<Map<String, Object>>
|
|||
|
||||
@Override
|
||||
public <E> List<E> getList(final String dest) {
|
||||
final List<E> value = super.getList(dest);
|
||||
if (value != null) {
|
||||
return value;
|
||||
try {
|
||||
final List<E> value = super.getList(dest);
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
} catch (ClassCastException e) {
|
||||
return List.of(this.<E>get(dest));
|
||||
}
|
||||
|
||||
return super.getList(dest + "s");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue