diff --git a/reflog.c b/reflog.c
index 333fd8708f..47ba8620c5 100644
--- a/reflog.c
+++ b/reflog.c
@@ -334,6 +334,8 @@ void reflog_expiry_prepare(const char *refname,
 		cb->unreachable_expire_kind = UE_HEAD;
 	} else {
 		commit = lookup_commit(the_repository, oid);
+		if (commit && is_null_oid(&commit->object.oid))
+			commit = NULL;
 		cb->unreachable_expire_kind = commit ? UE_NORMAL : UE_ALWAYS;
 	}
 
diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh
index 68f69bb543..ea8e6ac2a0 100755
--- a/t/t1410-reflog.sh
+++ b/t/t1410-reflog.sh
@@ -423,4 +423,13 @@ test_expect_success 'expire with multiple worktrees' '
 	)
 '
 
+test_expect_success REFFILES 'empty reflog' '
+	test_when_finished "rm -rf empty" &&
+	git init empty &&
+	test_commit -C empty A &&
+	>empty/.git/logs/refs/heads/foo &&
+	git -C empty reflog expire --all 2>err &&
+	test_must_be_empty err
+'
+
 test_done