diff --git a/salt/modules/cron.py b/salt/modules/cron.py
index <HASH>..<HASH> 100644
--- a/salt/modules/cron.py
+++ b/salt/modules/cron.py
@@ -604,10 +604,10 @@ def rm_job(user,
     if rm_ is not None:
         lst['crons'].pop(rm_)
         ret = 'removed'
-    comdat = _write_cron_lines(user, _render_tab(lst))
-    if comdat['retcode']:
-        # Failed to commit, return the error
-        return comdat['stderr']
+        comdat = _write_cron_lines(user, _render_tab(lst))
+        if comdat['retcode']:
+            # Failed to commit, return the error
+            return comdat['stderr']
     return ret
 
 rm = salt.utils.alias_function(rm_job, 'rm')
Don't create cron for cron.rm_job if no cron present for user