Fix potential NPE on exception path

Findbug reported NP_NULL_ON_SOME_PATH_EXCEPTION, Priority: Normal