Fix null pointer dereferencing

Signed-off-by: Kohei Takahashi <flast@flast.jp>