make reference to an empty query in flex
Posted
by Adam
on Stack Overflow
See other posts from Stack Overflow
or by Adam
Published on 2010-04-09T20:20:45Z
Indexed on
2010/04/09
20:23 UTC
Read the original article
Hit count: 281
a bit of a dumb questions I'm sure
I'm trying to allow user to set an item to be default. I've got a function that run a query to first find the current default item. Then runs a second query that unsets the current default item. Then a third query runs to set the new user selected item to be the default.
This seem to work fine when a default item has been perviously selected, but when I try to set the default item initially I get the good old "Cannot access a property or method of a null object reference." error.
This is because the first query that runs returns no items I'm sure. So I need to write an if statement that if the first query returns nothing to skip the second and go right to the third.
The only problem is I can't make a reference to a null object.
So how do I go about writing this statement.
Thanks
© Stack Overflow or respective owner