]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Fix #7669 About 'cancel inactive' crashing director
authorMichal Rakowski <michal.rakowski@baculasystems.com>
Thu, 20 May 2021 14:09:19 +0000 (16:09 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:02 +0000 (09:03 +0100)
bacula/src/dird/ua_select.c

index 2e19bc6b5dceca6229d4cb70fa4bd3bf17f0722c..fe8e4b92355bf7832367e32b0bbc792b38dd594b 100644 (file)
@@ -1159,10 +1159,12 @@ bool get_storage_resource(UAContext *ua, USTORE *ustore, bool use_default, bool
                ua->error_msg(_("JobId %s is not running.\n"), edit_int64(jobid, ed1));
                goto bail_out;
             }
-            STORE *wstore = jcr->store_mngr->get_wstore();
-            if (wstore) {
-               bstrncpy(store_name, wstore->name(), sizeof(store_name));
-               pm_strcpy(ustore->store_source, _("Command line (jobid parameter)"));
+            if (jcr->store_mngr) {
+               STORE *wstore = jcr->store_mngr->get_wstore();
+               if (wstore) {
+                  bstrncpy(store_name, wstore->name(), sizeof(store_name));
+                  pm_strcpy(ustore->store_source, _("Command line (jobid parameter)"));
+               }
             }
             free_jcr(jcr);
 
@@ -1176,10 +1178,12 @@ bool get_storage_resource(UAContext *ua, USTORE *ustore, bool use_default, bool
                ua->error_msg(_("Job \"%s\" is not running.\n"), ua->argv[i]);
                goto bail_out;
             }
-            STORE *wstore = jcr->store_mngr->get_wstore();
-            if (wstore) {
-               bstrncpy(store_name, wstore->name(), sizeof(store_name));
-               pm_strcpy(ustore->store_source, _("Command line (job/jobname parameter)"));
+            if (jcr->store_mngr) {
+               STORE *wstore = jcr->store_mngr->get_wstore();
+               if (wstore) {
+                  bstrncpy(store_name, wstore->name(), sizeof(store_name));
+                  pm_strcpy(ustore->store_source, _("Command line (job/jobname parameter)"));
+               }
             }
             free_jcr(jcr);
 
@@ -1189,10 +1193,12 @@ bool get_storage_resource(UAContext *ua, USTORE *ustore, bool use_default, bool
                goto bail_out;
             }
             if ((jcr=get_jcr_by_full_name(ua->argv[i]))) {
-               STORE *wstore = jcr->store_mngr->get_wstore();
-               if (wstore) {
-                  bstrncpy(store_name, wstore->name(), sizeof(store_name));
-                  pm_strcpy(ustore->store_source, _("Command line (ujobid parameter)"));
+               if (jcr->store_mngr) {
+                  STORE *wstore = jcr->store_mngr->get_wstore();
+                  if (wstore) {
+                     bstrncpy(store_name, wstore->name(), sizeof(store_name));
+                     pm_strcpy(ustore->store_source, _("Command line (ujobid parameter)"));
+                  }
                }
                free_jcr(jcr);
             }