From 359261c50c83f1046e3ccc143c44606123fc33c4 Mon Sep 17 00:00:00 2001 From: Eva Date: Sun, 2 Aug 2020 23:24:19 +0200 Subject: stats: fix crash when aspect ratio is unavailable When switching between files it's possible that r["aspect"] returns nil, resulting in a crash. --- player/lua/stats.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'player') diff --git a/player/lua/stats.lua b/player/lua/stats.lua index 17a71cc298..19d1848dd5 100644 --- a/player/lua/stats.lua +++ b/player/lua/stats.lua @@ -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 -- cgit v1.2.3