fixed NULL check

Fixed the if statement checking for NULL.