Skip to content

Commit

Permalink
fix: add NP checks in parse()
Browse files Browse the repository at this point in the history
  • Loading branch information
emptyOVO committed Dec 30, 2024
1 parent 3cff53e commit e7271f2
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,15 @@ public FibonacciFunction(Function expr) {

@Override
public Object parse(SourceData sourceData, int rowIndex, Context context) {
Object numberObj = numberParser.parse(sourceData, rowIndex, context);
BigDecimal numberValue = OperatorTools.parseBigDecimal(numberObj);
return fibonacci(numberValue.intValue());
if (numberParser != null) {
Object valueObj = numberParser.parse(sourceData, rowIndex, context);
if (valueObj == null) {
return null;
}
BigDecimal numberValue = OperatorTools.parseBigDecimal(valueObj);
return fibonacci(numberValue.intValue());
}
return null;
}

private long fibonacci(int n) {
Expand Down

0 comments on commit e7271f2

Please sign in to comment.