Skip to content

Commit 18c0bc2

Browse files
authored
fix(examples): raise proper SIGSEV instead of undefined behavior (#4930)
1 parent d872fbc commit 18c0bc2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sentry-samples/sentry-samples-android/src/main/cpp/native-sample.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#include <jni.h>
22
#include <android/log.h>
33
#include <sentry.h>
4+
#include <signal.h>
45

56
#define TAG "sentry-sample"
67

78
extern "C" {
89

910
JNIEXPORT void JNICALL Java_io_sentry_samples_android_NativeSample_crash(JNIEnv *env, jclass cls) {
1011
__android_log_print(ANDROID_LOG_WARN, TAG, "About to crash.");
11-
char *ptr = 0;
12-
*ptr += 1;
12+
raise(SIGSEGV);
1313
}
1414

1515
JNIEXPORT void JNICALL Java_io_sentry_samples_android_NativeSample_message(JNIEnv *env, jclass cls) {

0 commit comments

Comments
 (0)