nativeloader: Fix the case of search_path == null

When user creates custom classloader which does not extend
BaseDexClassLoader the librarySearchPath gets set to null
by java.lang.Runtime.doLoad().

This patch makes nativeloader correctly handle it.

Bug: http://b/28659864
Change-Id: I1b61c6bc952984d7c49775a9178fc3270948e62a
(cherry picked from commit 8a0425b86a)
This commit is contained in:
Dimitry Ivanov 2016-05-09 10:55:50 -07:00
parent 08660a811e
commit cf9892b6d1

View file

@ -56,7 +56,12 @@ class LibraryNamespaces {
jstring java_library_path,
jstring java_permitted_path,
int32_t target_sdk_version) {
ScopedUtfChars library_path(env, java_library_path);
std::string library_path; // empty string by default.
if (java_library_path != nullptr) {
ScopedUtfChars library_path_utf_chars(env, java_library_path);
library_path = library_path_utf_chars.c_str();
}
std::string permitted_path;
if (java_permitted_path != nullptr) {