From 97044a40cf08e2a3d196757086b03b65cf7b08b3 Mon Sep 17 00:00:00 2001
From: Kubat <mael.martin31@gmail.com>
Date: Sun, 9 Aug 2020 12:11:02 +0200
Subject: [PATCH] MODULE: Don't segfault when no internet connextion...

---
 src/module/module_repo.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/module/module_repo.c b/src/module/module_repo.c
index 4b402a5c..348756da 100644
--- a/src/module/module_repo.c
+++ b/src/module/module_repo.c
@@ -368,7 +368,10 @@ __worker_update(void *__repo)
     struct json_object *json;
     LOG_INFO("REPO", "Download kara list from %s (%s), directory is %s",
              repo->name, repo->get_all_json, repo->kara_dir);
-    __json_sync(repo, &json);
+    if (__json_sync(repo, &json)) {
+        LOG_ERROR("REPO", "Failed to get json, possibly no internet connexion or repo is down");
+        pthread_exit(NULL);
+    }
     __handle_got_json(repo->db, repo, json);
     LOG_INFO("REPO", "Finished to download and insert kara list");
     json_object_put(json);
-- 
GitLab