fix! method invocation if no arguments are supplied.
This commit is contained in:
parent
0a5aed38eb
commit
8257acbfbb
1 changed files with 10 additions and 2 deletions
|
@ -182,13 +182,21 @@ namespace Jellyfin.Plugin.SmartPlaylist.Lisp {
|
|||
private static Expression _invoke(IEnumerable<Expression> args) {
|
||||
Object o = (Object) args.First();
|
||||
String s = (String) args.Skip(1).First();
|
||||
Cons l = (Cons) args.Skip(2).First();
|
||||
IEnumerable<Expression> l;
|
||||
if (args.Skip(2).First() is Boolean lb && lb == Boolean.FALSE) {
|
||||
l = new List<Expression>();
|
||||
} else if (args.Skip(2).First() is Cons lc) {
|
||||
l = lc.ToList();
|
||||
} else {
|
||||
throw new ApplicationException($"Expected a list of arguments, got {args.Skip(2).First()}");
|
||||
}
|
||||
|
||||
IList<Expression> r = new List<Expression>();
|
||||
MethodInfo? mi = o.Value().GetType().GetMethod(s.Value());
|
||||
if (mi == null) {
|
||||
throw new ApplicationException($"{o.Value()} has not method {s.Value()}");
|
||||
}
|
||||
object?[]? l_ = l.ToList().Select<Expression, object?>(x => {
|
||||
object?[]? l_ = l.Select<Expression, object?>(x => {
|
||||
switch (x) {
|
||||
case Integer s:
|
||||
return s.Value();
|
||||
|
|
Loading…
Reference in a new issue