stats: fix crash when aspect ratio is unavailable

When switching between files it's possible that r["aspect"] returns nil, resulting in a crash.
This commit is contained in:
Eva 2020-08-02 23:24:19 +02:00 committed by avih
parent b238897614
commit 359261c50c
1 changed files with 3 additions and 1 deletions

View File

@ -545,7 +545,9 @@ local function add_video(s)
append(s, r["h"], {prefix="x", nl="", indent=" ", prefix_sep=" ", no_prefix_markup=true})
end
append_property(s, "current-window-scale", {prefix="Window Scale:"})
append(s, format("%.2f", r["aspect"]), {prefix="Aspect Ratio:"})
if r["aspect"] ~= nil then
append(s, format("%.2f", r["aspect"]), {prefix="Aspect Ratio:"})
end
append(s, r["pixelformat"], {prefix="Pixel Format:"})
-- Group these together to save vertical space