Fixed potential NullPointerException, where the input object could be null, but we still try to run toString on it