]> git.ipfire.org Git - pakfire.git/commitdiff
pakfire: Do not attempt to call callbacks when not set
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 9 Dec 2021 13:13:35 +0000 (13:13 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 9 Dec 2021 13:13:35 +0000 (13:13 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/pakfire.c

index 794f0d45f1bed6a831560f758847d8708546449e..94505c2c3d43387236b49312de9df6719a0d8b28 100644 (file)
@@ -1069,6 +1069,10 @@ void pakfire_call_status_callback(struct pakfire* pakfire, const char* message,
        va_list args;
        int r;
 
+       // Do nothing if call isn't set
+       if (!pakfire->callbacks.status)
+               return;
+
        // Format the message
        va_start(args, message);
        r = vasprintf(&buffer, message, args);
@@ -1086,6 +1090,10 @@ void pakfire_call_status_callback(struct pakfire* pakfire, const char* message,
 }
 
 void pakfire_call_progress_callback(struct pakfire* pakfire, int progress) {
+       // Do nothing if call isn't set
+       if (!pakfire->callbacks.progress)
+               return;
+
        pakfire->callbacks.progress(pakfire->callbacks.data, progress);
 }