#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 2465ef25b7 (Add event datagram socket)
more_events
Jose M. Guisado 2022-02-01 15:54:08 +01:00
parent ecd735c9dc
commit 700aa89ea9
1 changed files with 1 additions and 1 deletions

View File

@ -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