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.
This commit is contained in:
Graham McIntire 2026-05-09 11:26:41 -05:00
parent 5184d2ee5e
commit 6f1d4eee4e
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59

View file

@ -183,6 +183,8 @@ defmodule MixUnused.Analyzer do
{{^name, ^arity}, _kind, meta, _clauses} -> Keyword.get(meta, :line)
_ -> nil
end)
else
_ -> nil
end
rescue
_ -> nil