summaryrefslogtreecommitdiffstats
path: root/libnativeloader
diff options
context:
space:
mode:
authorDimitry Ivanov <dimitry@google.com>2016-05-09 10:55:50 -0700
committerDimitry Ivanov <dimitry@google.com>2016-05-09 10:55:50 -0700
commit8a0425b86acd4f20ef68ef350ac32e1c5057c558 (patch)
treed7d92f136687cf30e93c2e3c240df9eeb0e0d400 /libnativeloader
parentfc2a8b2bd605e4639db0feaab49c516c0ae90180 (diff)
downloadsystem_core-8a0425b86acd4f20ef68ef350ac32e1c5057c558.tar.gz
system_core-8a0425b86acd4f20ef68ef350ac32e1c5057c558.tar.bz2
system_core-8a0425b86acd4f20ef68ef350ac32e1c5057c558.zip
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
Diffstat (limited to 'libnativeloader')
-rw-r--r--libnativeloader/native_loader.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/libnativeloader/native_loader.cpp b/libnativeloader/native_loader.cpp
index 7f21375bd..33d5b62a4 100644
--- a/libnativeloader/native_loader.cpp
+++ b/libnativeloader/native_loader.cpp
@@ -54,7 +54,12 @@ class LibraryNamespaces {
bool is_shared,
jstring java_library_path,
jstring java_permitted_path) {
- 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) {