fix null ptr error when compiling on mobile