From dc6db91c83bc1311e48624c913bacd9f81459108 Mon Sep 17 00:00:00 2001 From: Jaeyun Jung Date: Wed, 18 Mar 2026 13:41:17 +0900 Subject: [PATCH] [Android] handle error from ml-agent Handle error case when initializing mlops-agent in Android build. Signed-off-by: Jaeyun Jung --- .../nnstreamer/src/main/jni/nnstreamer-native-common.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/java/android/nnstreamer/src/main/jni/nnstreamer-native-common.c b/java/android/nnstreamer/src/main/jni/nnstreamer-native-common.c index c3cee83c..780a0163 100644 --- a/java/android/nnstreamer/src/main/jni/nnstreamer-native-common.c +++ b/java/android/nnstreamer/src/main/jni/nnstreamer-native-common.c @@ -29,7 +29,7 @@ static gchar *g_files_dir = NULL; #if defined(__ANDROID__) #if defined(ENABLE_ML_AGENT) -extern void ml_agent_initialize (const char *db_path); +extern int ml_agent_initialize (const char *db_path); extern void ml_agent_finalize (void); #endif /* nnstreamer plugins and sub-plugins declaration */ @@ -491,7 +491,10 @@ nnstreamer_native_initialize (JNIEnv * env, jobject context) gchar *mlops_db_path = g_build_filename (g_files_dir, "mlops-db", NULL); g_mkdir (mlops_db_path, 0777); - ml_agent_initialize (mlops_db_path); + if (ml_agent_initialize (mlops_db_path) < 0) { + _ml_loge ("Failed to initialize mlops-agent."); + goto done; + } g_free (mlops_db_path); } #endif