diff --git a/src/plugins/markdown-report/markdown.ml b/src/plugins/markdown-report/markdown.ml
index 3dc4823cc7042d33c7a26a8f07035ef1f7e6e6be..532cce93b985b6d45ea92bee9beb25e1cc205716 100644
--- a/src/plugins/markdown-report/markdown.ml
+++ b/src/plugins/markdown-report/markdown.ml
@@ -89,9 +89,8 @@ let pp_headers fmt l sizes =
 
 let compute_sizes headers contents =
   let check_line i m line =
-    match List.nth_opt line i with
-    | Some t -> max m (test_size t + 2)
-    | None -> m
+    try max m (test_size (List.nth line i) + 2)
+    with Failure _ -> m
   in
   let column_size (i,l) (h,_) =
     let max = List.fold_left (check_line i) (test_size h) contents in