Fix if test

was originally testing for NULL value in one field and printing
another, which could possibly result in an invalid memory reference.