Handlebars-Net / Handlebars.Net.Helpers

Handlebars.Net helpers in the categories: 'Boolean', 'Constants', 'Enumerable', 'Environment', 'Math', 'Regex', 'String', 'DateTime' and 'Url'.
MIT License
38 stars 14 forks source link

Stack Overflow on Math.Subtract and empty string #36

Closed Zulu-Inuoe closed 3 years ago

Zulu-Inuoe commented 3 years ago

When given an empty string, Math.Subtract helper is causing a Stack Overflow:

var handlebars= HandlebarsDotNet.Handlebars.Create();
HandlebarsHelpers.Register(handlebars);

handlebars.Compile("{{Math.Subtract 100 ''}}")(null);

There's no stack trace available but the TargetSite is listed as System.Reflection.MethodBase

Zulu-Inuoe commented 3 years ago

FYI this was user error, and I'm not sure what it -should- do. But I don't think it should crash the app, at least.

StefH commented 3 years ago

@Zulu-Inuoe Can you try MyGet version 2.1.8-ci-15110?

(https://github.com/Handlebars-Net/Handlebars.Net.Helpers/wiki/MyGet)

Zulu-Inuoe commented 3 years ago

@StefH Yes! That works. I'm now seeing a

System.NotSupportedException: 'The value '' cannot not be converted to an int, long or double.'

which I think is reasonable. I'm not able to run more extensive tests until tomorrow but I'll keep you posted if I see anything

StefH commented 3 years ago

OK, keep me posted.

Zulu-Inuoe commented 3 years ago

Hi @StefH just letting you know it's working fine for us. I appreciate you looking into these issues so quickly!

StefH commented 3 years ago

A new version will be released shortly.