Well, it's pretty simple. In
updateComportList
method you set the values of your
ComPortList
array. Then you get the first element of the array (which remember, has just been set) and you check it for
null
.
As the array element at position 0 has just been set (is not null anymore) and you assign its value to your string variable
tmpPort
, that string is no longer null. That's why your condition fails.
pieterjann wrote:
btw, if you know a better title, or can improve my question to make it useful in the future
To be honest, I was a bit taken aback at the title. Most questions here ask why the code
doesn't work, so I thought it a typo (and a funny one at that).
After fully reading your question however, it seems properly phrased and to the point. So I will give you a 5 for it (which happens quite rarely)
EDIT: After Wes' repost notice, I gave this a 1 for reposting.