diff --git a/src/slurmctld/step_mgr.c b/src/slurmctld/step_mgr.c
index 932bd8174639d78beeb693e73d9e00cc9a30cdef..a2a7d8e85bb81894b8beb0172896fde9271e5519 100644
--- a/src/slurmctld/step_mgr.c
+++ b/src/slurmctld/step_mgr.c
@@ -2708,7 +2708,8 @@ extern int step_partial_comp(step_complete_msg_t *req, uid_t uid,
 	/* we have been adding task average frequencies for
 	 * jobacct->act_cpufreq so we need to divide with the
 	 * total number of tasks/cpus for the step average frequency */
-	step_ptr->jobacct->act_cpufreq /= step_ptr->cpu_count;
+	if (step_ptr->cpu_count)
+		step_ptr->jobacct->act_cpufreq /= step_ptr->cpu_count;
 
 	if (!step_ptr->exit_node_bitmap) {
 		/* initialize the node bitmap for exited nodes */