diff options
author | Eva <evauwu@riseup.net> | 2020-08-02 23:24:19 +0200 |
---|---|---|
committer | avih <avih@users.noreply.github.com> | 2020-08-03 00:50:57 +0300 |
commit | 359261c50c83f1046e3ccc143c44606123fc33c4 (patch) | |
tree | bcafce7accf8414bb8cb50df9da3dd73670cfd8b /player/lua/stats.lua | |
parent | b238897614ae016401d4c118ec6eb10fa5717f9b (diff) | |
download | mpv-359261c50c83f1046e3ccc143c44606123fc33c4.tar.bz2 mpv-359261c50c83f1046e3ccc143c44606123fc33c4.tar.xz |
stats: fix crash when aspect ratio is unavailable
When switching between files it's possible that r["aspect"] returns nil, resulting in a crash.
Diffstat (limited to 'player/lua/stats.lua')
-rw-r--r-- | player/lua/stats.lua | 4 |
1 files changed, 3 insertions, 1 deletions
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 |