From f6601766f17bf5147fed8f417fd532108e221990 Mon Sep 17 00:00:00 2001 From: Rafostar <40623528+Rafostar@users.noreply.github.com> Date: Mon, 4 Jan 2021 22:31:25 +0100 Subject: [PATCH] Fix crash on undetected codec Player StreamInfo might return a null if codec is undetermined --- clapper_src/widget.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/clapper_src/widget.js b/clapper_src/widget.js index e7569eff..fa32d245 100644 --- a/clapper_src/widget.js +++ b/clapper_src/widget.js @@ -218,12 +218,13 @@ var Widget = GObject.registerClass({ }; for(let info of streamList) { - let type, text; + let type, text, codec; switch(info.constructor) { case GstPlayer.PlayerVideoInfo: type = 'video'; - text = info.get_codec() + ', ' + + codec = info.get_codec() || 'Undetermined'; + text = codec + ', ' + + info.get_width() + 'x' + info.get_height(); let fps = info.get_framerate(); @@ -233,7 +234,7 @@ var Widget = GObject.registerClass({ break; case GstPlayer.PlayerAudioInfo: type = 'audio'; - let codec = info.get_codec(); + codec = info.get_codec() || 'Undetermined'; if(codec.includes('(')) { codec = codec.substring( codec.indexOf('(') + 1,