You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit introduced a bug. Getting the variable source on the same line that the cast to (int) is on only works if the variable source returns an index value. I believe it just needs null guarded to work correctly.
After debugging our project locally to see what was going on, I have this relatively simple fix.
var index = 0;
try {
var vsIndex = variableSource.GetVariable("index");
if (vsIndex != null) {
index = (int)vsIndex;
}
} catch (VariableNotFoundException) {
}
At first I was confused as to why the try catch, but then I realized that the variable source may not have ThrowIfNotFound set to True. In that case the try catch is very important. However, not sure how, but would be nice to be able to do something like this without the try catch...
In any case, it is a simple fix.
The text was updated successfully, but these errors were encountered:
dgwaldo
added a commit
to dgwaldo/OpenXmlTemplates
that referenced
this issue
Apr 16, 2024
However, not sure how, but would be nice to be able to do something like this without the try catch...
I agree, there are better ways to do this especially looking back at it, but at the moment bug fixing is the priority so i merged it and released version 2.0.6 with the fix, it should be available soon in Nuget
This commit introduced a bug. Getting the variable source on the same line that the cast to (int) is on only works if the variable source returns an index value. I believe it just needs null guarded to work correctly.
After debugging our project locally to see what was going on, I have this relatively simple fix.
At first I was confused as to why the try catch, but then I realized that the variable source may not have ThrowIfNotFound set to True. In that case the try catch is very important. However, not sure how, but would be nice to be able to do something like this without the try catch...
In any case, it is a simple fix.
The text was updated successfully, but these errors were encountered: