From 20812dc872a35c6001f1e009ba9d9922c86277ee Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Sun, 7 Apr 2019 17:43:14 +0200 Subject: [PATCH] Add error handling for incomplete Timing information on Modelines --- library/xrandr_facts.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/library/xrandr_facts.py b/library/xrandr_facts.py index a725f9e..ed02151 100755 --- a/library/xrandr_facts.py +++ b/library/xrandr_facts.py @@ -211,7 +211,14 @@ def parse_edid_data(edid): if "Modeline" in line: print(line) _, _, line = line.split('"', 2) - FF, H1, H2, H3, H4, V1, V2, V3, V4, FLAGS = line.split(None, 9) + if not line: + print("no timing information") + continue + try: + FF, H1, H2, H3, H4, V1, V2, V3, V4, FLAGS = line.split(None, 9) + except ValueError: + print("invalid timing information") + continue print(FF, H1, H2, H3, H4, V1, V2, V3, V4, FLAGS) refresh = round(float(FF) * 1E6 / (float(H4) * float(V4))) interlaced = "interlaced" in FLAGS