diff --git a/app/models/foreman_tasks/recurring_logic.rb b/app/models/foreman_tasks/recurring_logic.rb
index <HASH>..<HASH> 100644
--- a/app/models/foreman_tasks/recurring_logic.rb
+++ b/app/models/foreman_tasks/recurring_logic.rb
@@ -31,12 +31,12 @@ module ForemanTasks
         if value
           task.update!(:start_at => next_occurrence_time) if task.start_at < Time.zone.now
           update(:state => 'active')
-        else
-          update(:state => 'disabled')
         end
-      else
+      elsif value
         raise RecurringLogicCancelledException
       end
+
+      update(:state => 'disabled') unless value
     end
 
     def enabled?
diff --git a/test/unit/recurring_logic_test.rb b/test/unit/recurring_logic_test.rb
index <HASH>..<HASH> 100644
--- a/test/unit/recurring_logic_test.rb
+++ b/test/unit/recurring_logic_test.rb
@@ -148,6 +148,12 @@ class RecurringLogicsTest < ActiveSupport::TestCase
         assert ForemanTasks.dynflow.world.persistence.load_delayed_plan(task.execution_plan.id).frozen
       end
 
+      it 'handles if the task has been deleted' do
+        logic.tasks.find_by(:state => 'scheduled').destroy
+        logic.update!(:enabled => false)
+        assert_equal 'disabled', logic.state
+      end
+
       it 'properly re-enables on disable' do
         logic.update!(:enabled => false)
         logic.update!(:enabled => true)
Fixes #<I> - fix disable on rec logic with deleted task