LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Close Null Reference Behavior

Solved!
Go to solution

Hello,

I have a question regarding the behavior of the "Close Reference" when attempting to close a Null Reference.  Will LabVIEW look at that and move on or will it produce an error?  I also read in the "Help" that you can give it an array of references and it will close them all.  However, what if one of the Ref in the array is Null?  Will it close all the actual ref and continue on with an error, or does it function like a For Loop passing around the Error cluster in the shift register thus preventing it from closing any other Ref?  I would simply make test code to answer my own question, but as embarassing as this is, I'm not entirely sure if sending it a blank ref is the same as sending it a Null Ref.  You can answer that one as well if you wish.  Thank you.

0 Kudos
Message 1 of 4
(3,776 Views)

I haven't exhaustively tested Close Reference, but I've never seen it throw an error even when I know the reference wasn't valid.


@DailyDose wrote:

I would simply make test code to answer my own question, but as embarassing as this is, I'm not entirely sure if sending it a blank ref is the same as sending it a Null Ref.  You can answer that one as well if you wish.  Thank you.


What do you mean by a "blank" reference versus a "null" one? How would you determine if these were the same thing? I'd drop a constant of the desired reference type onto your block diagram; now you have a reference of the correct type that doesn't refer to anything.

0 Kudos
Message 2 of 4
(3,755 Views)
Solution
Accepted by topic author DailyDose

It looks like it will produce an error if you input a null reference, and that just sending some kind of reference constant that you didn't actually open is indeed null. If you try to close an array of references, it looks like it will try to close them all, even if there is a null reference somewhere in the middle.

 

close refs.png

Message 3 of 4
(3,752 Views)

@nathand wrote:

 

What do you mean by a "blank" reference versus a "null" one? How would you determine if these were the same thing? I'd drop a constant of the desired reference type onto your block diagram; now you have a reference of the correct type that doesn't refer to anything.


Well, I meant by dropping a ref that doesn't actually point to anything.  I guess that is considered a null ref?  But it looks like gregoryj answered my question.

0 Kudos
Message 4 of 4
(3,738 Views)