diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2024-08-22 00:09:34 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2024-08-22 00:09:34 +0200 |
| commit | 275de81f854be66f575e3c8e36a0c1b56281e788 (patch) | |
| tree | 33952a7c373df3fb530e8c4bd2fa172308c1edb0 /libs/samba/src/main/cpp | |
| parent | d41f82b99e405e1b6ef2e75d32efa31d91893824 (diff) | |
samba: Fix crash when url->path == null
Diffstat (limited to 'libs/samba/src/main/cpp')
| -rw-r--r-- | libs/samba/src/main/cpp/samba.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libs/samba/src/main/cpp/samba.cpp b/libs/samba/src/main/cpp/samba.cpp index 7266a7f..1d1d9d2 100644 --- a/libs/samba/src/main/cpp/samba.cpp +++ b/libs/samba/src/main/cpp/samba.cpp @@ -210,7 +210,8 @@ void nativeUrlDestroy(JNIEnv* env, jclass clazz, jlong ptr) { } jstring nativeUrlPath(JNIEnv* env, jclass clazz, jlong ptr) { - return jni::UTF8ToString(env, std::string(reinterpret_cast<Url*>(ptr)->path())).release(); + auto* path = reinterpret_cast<Url*>(ptr)->path(); + return jni::UTF8ToString(env, std::string(path ? path : "")).release(); } void nativeDirDestroy(JNIEnv* env, jclass clazz, jlong ptr) { |
