This adds handling for null pointer in errout route as it crashes my ostest sometimes. Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>