Hi I got a problem few days ago and bother me a long time to figure out why…
When I pass an empty string (e.g. “”) from java to c*+ using jni, and I use JniHelper::jstring2string to get std::string object in c*+,
the app will crash after few functions run. But if you pass a space or something else, the program works fine!
And finally I found out the location cause crash is when assign a char * to std::string in JniHelper::jstring2string.
But the interest thing is if I change to use stlport_static, program works fine with empty string returns…
I think it is because the implementation of gnustl_static or stlport_static do some magic things.
But I can not use stlport_static because it cause touch crash problem (dynamic_cast)
I can not attach a file so I put the project zip here http://wayne.cs.nthu.edu.tw/~splash/crashTest.zip
This project can reproduce the problem I explain.
I use cocos2d-1.0.1-x-0.11.0