diff --git a/app/src/main/cpp/java.cpp b/app/src/main/cpp/java.cpp index fa30f28..def9607 100644 --- a/app/src/main/cpp/java.cpp +++ b/app/src/main/cpp/java.cpp @@ -27,7 +27,7 @@ void rethrow(JNIEnv *env) { if (clazz) env->ThrowNew(clazz, e.what()); } catch (const std::exception &e) { // unknown - jclass clazz = env->FindClass("java/lang/Error"); + jclass clazz = env->FindClass("com/kdrag0n/tipatch/jni/NativeException"); if (clazz) env->ThrowNew(clazz, e.what()); } diff --git a/app/src/main/java/com/kdrag0n/tipatch/MainActivity.kt b/app/src/main/java/com/kdrag0n/tipatch/MainActivity.kt index 9babf38..6b6364e 100644 --- a/app/src/main/java/com/kdrag0n/tipatch/MainActivity.kt +++ b/app/src/main/java/com/kdrag0n/tipatch/MainActivity.kt @@ -27,6 +27,7 @@ import com.crashlytics.android.Crashlytics import com.kdrag0n.tipatch.jni.CompressException import com.kdrag0n.tipatch.jni.Image import com.kdrag0n.tipatch.jni.ImageException +import com.kdrag0n.tipatch.jni.NativeException import com.kdrag0n.utils.* import com.leinardi.android.speeddial.SpeedDialActionItem import com.leinardi.android.speeddial.SpeedDialView @@ -523,7 +524,7 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh Crashlytics.logException(e) } - is Error -> { + is NativeException -> { if (e.message != null) { errorDialog(R.string.err_native_unknown(e.message!!), appIssue = true) } else { diff --git a/app/src/main/java/com/kdrag0n/tipatch/jni/NativeException.java b/app/src/main/java/com/kdrag0n/tipatch/jni/NativeException.java new file mode 100644 index 0000000..69a8add --- /dev/null +++ b/app/src/main/java/com/kdrag0n/tipatch/jni/NativeException.java @@ -0,0 +1,7 @@ +package com.kdrag0n.tipatch.jni; + +public class NativeException extends RuntimeException { + public NativeException(String text) { + super(text); + } +}