aboutsummaryrefslogtreecommitdiffstats
path: root/java_jni/jni
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2022-05-09 01:24:33 +0200
committerSven Gothel <[email protected]>2022-05-09 01:24:33 +0200
commite5421ff1dfed4d26ac40542252aba0c4bb1094b5 (patch)
tree03da8b62e928b3afc7c22d77cf16d10422770d1e /java_jni/jni
parentf61e1835c9a7e547342393f7a77098b7bfd68d22 (diff)
Use `std::shared_ptr<T>` instead of a `naked pointer` for sane lifcycle, see shared_ptr_ref<>; Drop all unique_ptr<> funcs;
- Store `std::shared_ptr<T>*` in `long nativeInstance` - Introduced `shared_ptr_ref<T>`, managing the `std::shared_ptr<T>*` preserved instances. - All historic TinyB code removed
Diffstat (limited to 'java_jni/jni')
-rw-r--r--java_jni/jni/helper_jni.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/java_jni/jni/helper_jni.cxx b/java_jni/jni/helper_jni.cxx
index b9fa08a..3105e07 100644
--- a/java_jni/jni/helper_jni.cxx
+++ b/java_jni/jni/helper_jni.cxx
@@ -1,11 +1,8 @@
/*
* Author: Sven Gothel <[email protected]>
- * Copyright (c) 2020 Gothel Software e.K.
+ * Copyright (c) 2020, 2022 Gothel Software e.K.
* Copyright (c) 2020 ZAFENA AB
*
- * Author: Andrei Vasiliu <[email protected]>
- * Copyright (c) 2016 Intel Corporation.
- *
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@@ -194,6 +191,9 @@ void jau::rethrow_and_raise_java_exception_jauimpl(JNIEnv *env, const char* file
//
jfieldID jau::getField(JNIEnv *env, jobject obj, const char* field_name, const char* field_signature) {
+ if( nullptr == obj ) {
+ return nullptr;
+ }
jclass clazz = env->GetObjectClass(obj);
java_exception_check_and_throw(env, E_FILE_LINE);
// J == long