Skip to content

Commit a8c72dd

Browse files
authored
Fix ensure ndk libs are loaded before calling close (#3797)
1 parent 87bdc75 commit a8c72dd

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

sentry-android-ndk/src/main/java/io/sentry/android/ndk/SentryNdk.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ public static void init(@NotNull final SentryAndroidOptions options) {
6969

7070
/** Closes the NDK integration */
7171
public static void close() {
72-
shutdown();
72+
try {
73+
if (loadLibraryLatch.await(2000, TimeUnit.MILLISECONDS)) {
74+
shutdown();
75+
} else {
76+
throw new IllegalStateException("Timeout waiting for Sentry NDK library to load");
77+
}
78+
} catch (InterruptedException e) {
79+
throw new IllegalStateException(
80+
"Thread interrupted while waiting for NDK libs to be loaded", e);
81+
}
7382
}
7483
}

0 commit comments

Comments
 (0)