From 6f1d4eee4e8403f7858d240a8c7c9cfdd72a143d Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Sat, 9 May 2026 11:26:41 -0500 Subject: [PATCH] Fix Analyzer.debug_info_line to return nil on with-fallthrough When :beam_lib.chunks fails (e.g. a project module hasn't been loaded into :code.which yet), the existing with returned the raw error tuple as the 'line' value, which then crashed format/1 via String.Chars. Add an explicit else clause so the function always returns nil or an integer. --- lib/mix_unused/analyzer.ex | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/mix_unused/analyzer.ex b/lib/mix_unused/analyzer.ex index 6a472df..f79fde4 100644 --- a/lib/mix_unused/analyzer.ex +++ b/lib/mix_unused/analyzer.ex @@ -183,6 +183,8 @@ defmodule MixUnused.Analyzer do {{^name, ^arity}, _kind, meta, _clauses} -> Keyword.get(meta, :line) _ -> nil end) + else + _ -> nil end rescue _ -> nil