summaryrefslogtreecommitdiff
path: root/xgps
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2018-12-27 19:57:33 -0800
committerGary E. Miller <gem@rellim.com>2018-12-27 19:57:33 -0800
commit41d3943276c922aed53984b3e5948b6814b35b0d (patch)
treeab9da8b17a013a9999c003f9c58c1ccb9fe74d7c /xgps
parent20845f4a6741e6c925dd386245ecfe5bee44b3fd (diff)
downloadgpsd-41d3943276c922aed53984b3e5948b6814b35b0d.tar.gz
xgps: Wanr, not segfault, on missing DISPLAY variable.
Diffstat (limited to 'xgps')
-rwxr-xr-xxgps7
1 files changed, 6 insertions, 1 deletions
diff --git a/xgps b/xgps
index 5a622151..4f82a18e 100755
--- a/xgps
+++ b/xgps
@@ -25,12 +25,13 @@ usage: xgps [-?] [-D level] [-h] [-l degmfmt] [-r rotation] [-u units] [-V]
# Preserve this property!
from __future__ import absolute_import, print_function, division
+import cairo
import math
+import os
import socket
import sys
import time
-import cairo
# Gtk3 imports. Gtk3 requires the require_version(), which then causes
# pylint to complain about the subsequent "non-top" imports.
@@ -1304,6 +1305,10 @@ if __name__ == "__main__":
else:
target = ""
+ if 'DISPLAY' not in os.environ:
+ sys.stderr.write("xgps: ERROR: DISPLAY not set\n")
+ exit(1)
+
base = Base(deg_type=degreefmt, rotation=rotate, title=target)
base.set_units(unit_system)
try: