title: Checking for Null Bytes
body: <p>I'm using Visual Basic .NET to work with a USB HID device.</p>
  
  <p>Most of the time, I can receive data from it perfectly... but one out of every thousand transfers or so, my code will think it has received data when it actually hasn't.</p>
  
  <p>The device writes to an array of bytes. I wanted to check to see if the received packet is empty, by doing something like this:</p>
  
  <pre><code>If myDevice.dataPacket(1) &lt;&gt; Nothing then
      myDevice.rxDataReady = False
  </code></pre>
  
  <p>Unfortunately, even with this I get a NullReferenceException, saying that the object reference is not set to an instance of an object.</p>
  
  <p>Is there a different way to do this, or should I just handle a NullReferenceException? If I execute this routine hundreds of times a minute, will adding the exception slow things down at all?</p>