Merge pull request #9266 from Dhilan007/v3-lua-fix

Fixed compiling and linking error of lua tests when using NDK r10 above.
add null pointer check, make code more robust
Merge pull request #9275 from andyque/fixLoadingBarGetSprite

add null pointer check, make code more robust