Skip to content

Fix: CalculatorSkill NPE when scoring operators in generateOutput#417

Merged
Stypox merged 2 commits into
DicioTeam:mainfrom
mretallack:fix/calculator-npe
May 13, 2026
Merged

Fix: CalculatorSkill NPE when scoring operators in generateOutput#417
Stypox merged 2 commits into
DicioTeam:mainfrom
mretallack:fix/calculator-npe

Conversation

@mretallack
Copy link
Copy Markdown
Contributor

standardMatchHelper is set to null after skill scoring completes, but CalculatorSkill.getOperation() calls operatorSection.score() during generateOutput, which requires a MatchHelper.

Add a score(MatchHelper, String) overload to StandardRecognizerData so callers can provide their own MatchHelper. CalculatorSkill now creates a local MatchHelper for the operator text being matched.

standardMatchHelper is set to null after skill scoring completes, but
CalculatorSkill.getOperation() calls operatorSection.score() during
generateOutput, which requires a MatchHelper.

Add a score(MatchHelper, String) overload to StandardRecognizerData so
callers can provide their own MatchHelper. CalculatorSkill now creates
a local MatchHelper for the operator text being matched.
Verifies that score() works with an explicit MatchHelper, which is
needed when skills call score() during generateOutput where
ctx.standardMatchHelper is null.
Copy link
Copy Markdown
Collaborator

@Stypox Stypox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

I guess it would be great to somehow write a test for each skill, that tests the whole evaluation infrastructure with just that skill and makes sure the right thing happens. But this is for the future.

Comment on lines +24 to +25
val helper = MatchHelper(ctx.parserFormatter, text)
val (score, result) = operatorSection.score(helper, text)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this makes sense anyway, it was using a helper set up with the wrong text earlier

@Stypox Stypox marked this pull request as ready for review May 13, 2026 12:04
@Stypox Stypox merged commit e62158b into DicioTeam:main May 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants