Skip to content

Conversion between a non-nullable and nullable type can throw an exce…#380

Merged
xoofx merged 2 commits intoscriban:masterfrom
JvanderStad:bugfix/nullable-conversion
Sep 22, 2021
Merged

Conversion between a non-nullable and nullable type can throw an exce…#380
xoofx merged 2 commits intoscriban:masterfrom
JvanderStad:bugfix/nullable-conversion

Conversation

@JvanderStad
Copy link
Copy Markdown
Contributor

I had an exception while converting an Int32 to a Nullable<Int64>. The TrySetValue method now converts the prop/field value with method ChangeType.

ChangeType checks if the target type is a nullable and tries to change the type to the underlaying type of the nullable type

Comment thread src/Scriban/Runtime/Accessors/TypedObjectAccessor.cs Outdated
@JvanderStad
Copy link
Copy Markdown
Contributor Author

@xoofx Any chance you could merge this PR? Thanks! 👍

@xoofx xoofx merged commit c3eea2e into scriban:master Sep 22, 2021
@xoofx
Copy link
Copy Markdown
Member

xoofx commented Sep 22, 2021

Yep, sorry, thanks!

@JvanderStad JvanderStad deleted the bugfix/nullable-conversion branch September 22, 2021 04:28
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