]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/commitdiff
Make mode parsing more robust for broken cases
authorPhillip Berndt <phillip.berndt@googlemail.com>
Sun, 24 Mar 2019 19:42:02 +0000 (20:42 +0100)
committerPhillip Berndt <phillip.berndt@googlemail.com>
Sun, 24 Mar 2019 19:42:02 +0000 (20:42 +0100)
autorandr.py

index d80b7d96b8bb5f79798958e0d90f3b23d5042001..84361bed73617323d8218ff4879c9e1d42297035 100755 (executable)
@@ -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["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:
                 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":
             if match["primary"]:
                 options["primary"] = None
             if match["reflect"] == "X":