Check for null ptr to avoid segfault when using APIs wrong.
Check for null ptr to avoid segfault when using APIs wrong.

zcsteele/turbo,mniestroj/turbo,zcsteele/turbo,YuanPeir-Chen/turbo-support-mipsel,kernelsauce/turbo,YuanPeir-Chen/turbo-support-mipsel