How to check for empty and not a failure

You test for a fail by explicitly testing for false:

if (null === $mypostids) { /* it failed */ }

NB: three equals signs! you want to check for identical, not just equivalent

edit: originally said false, changed to null after looking at get_result() function in source.