diff --git a/src/subfind/subfind_history.cc b/src/subfind/subfind_history.cc
index 571805d763bfe5b7055012c30ca723d3a72acb85..d1605807b533e5a9463ea45e04f5ab49d7428bcb 100644
--- a/src/subfind/subfind_history.cc
+++ b/src/subfind/subfind_history.cc
@@ -289,8 +289,6 @@ void fof<partset>::subfind_hbt_single_group(domain<partset> *SubDomain, domain<p
       /* sort the candidates by size */
       mycxxsort(all_candidates, all_candidates + totcand, subfind_hbt_compare_subcand_len);
 
-      hbt_subcand_t maxlen_candidate = all_candidates[totcand - 1];
-
       /* sort the candidates by summed previous length, as this is arguably a more robust decision of which one should be the largest
        */
       mycxxsort(all_candidates, all_candidates + totcand, subfind_hbt_compare_subcand_summedprevlen);