From: Phillip Berndt Date: Sun, 24 Mar 2019 19:42:02 +0000 (+0100) Subject: Make mode parsing more robust for broken cases X-Git-Tag: upstream/1.8.1~7 X-Git-Url: https://git.donarmstrong.com/?p=deb_pkgs%2Fautorandr.git;a=commitdiff_plain;h=38c65b12f1f8b5ce7e8623717e430879a8301723 Make mode parsing more robust for broken cases --- diff --git a/autorandr.py b/autorandr.py index d80b7d9..84361be 100755 --- a/autorandr.py +++ b/autorandr.py @@ -332,10 +332,11 @@ class XrandrOutput(object): options["mode"] = "%sx%s" % (match["mode_width"], match["mode_height"]) else: if match["rotate"] not in ("left", "right"): - options["mode"] = "%sx%s" % (match["width"], match["height"]) + options["mode"] = "%sx%s" % (match["width"] or 0, match["height"] or 0) else: - options["mode"] = "%sx%s" % (match["height"], match["width"]) - options["rotate"] = match["rotate"] + options["mode"] = "%sx%s" % (match["height"] or 0, match["width"] or 0) + if match["rotate"]: + options["rotate"] = match["rotate"] if match["primary"]: options["primary"] = None if match["reflect"] == "X":