Forum

C# plugin null value on int pin

How do I deal with null values from 4v on a int pin in a c# plugin?

hi gareth,

an int pin shouldn’t have null as value since int is not a nullable type. if that happens, there must be another issue with the setup.

can you provide more context?

Hey buddy

It’s very common for 4v to give a null value, ie. from a hit test that is not outputting a hit on the index pin.

If I feed the index from the hittest into a c# plugin and a null value is present the plugin goes red. Is there a way of dealing with null values inside of the c# plugin? Int can’t be null, so how do I only accept input when there is a value instead of a null?

Well first of i do a Multiflipflop (Advnaced) and OR (Spectral) to avoid this case.
This case leads to often to unexpected troubles down the patch… But i’m not sure if you need multiple hits…

As for c# you can pretty much check spread count, i think there are other ways too…
The only case that dosn’t work if FIn == null, but FIn[0] == null should work i think

Yes, check before evaluation. If the spread is null or the count is zero, then you can output some default value or whatever makes sense in that case…

Thanks guys I’ll give it a go =)