Catch error condition to prevent NULL pointer dereference.