From 700aa89ea99c7d48350fb99c947c60fc02c0323e Mon Sep 17 00:00:00 2001 From: "Jose M. Guisado" Date: Tue, 1 Feb 2022 15:54:08 +0100 Subject: #1065 Use getattr when retrieving event socket If ogClient does not run on windows or linux mode, it does not create a datagram event socket. If ogClient runs in virtual or live mode this will cause an error when calling get_event_socket because the class instance has no member "event_sock". Use getattr when retrieving the event socket from ogClient class, if there is no event socket, then return None. Fixes 2465ef25b741 (Add event datagram socket) --- src/ogClient.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ogClient.py b/src/ogClient.py index a167c71..29b2ebf 100644 --- a/src/ogClient.py +++ b/src/ogClient.py @@ -48,7 +48,7 @@ class ogClient: return self.sock def get_event_socket(self): - return self.event_sock + return getattr(self, 'event_sock', None) def get_state(self): return self.state -- cgit v1.2.3-18-g5258