Skip to content

Commit 925c58e

Browse files
authored
getFog() will only be called if the server is running
1 parent bede047 commit 925c58e

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

plugins/mission/status.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,15 @@ async def render(self, server: Server):
120120
self.add_field(name='Weather', value='Dynamic\n**Clouds**\nn/a')
121121

122122
visibility = weather['visibility']['distance']
123-
try:
124-
ret = await server.send_to_dcs_sync({
125-
"command": "getFog"
126-
})
127-
if ret['visibility']:
128-
visibility = int(ret['visibility'])
129-
except (TimeoutError, asyncio.TimeoutError):
130-
pass
123+
if server.status == Status.RUNNING:
124+
try:
125+
ret = await server.send_to_dcs_sync({
126+
"command": "getFog"
127+
})
128+
if ret['visibility']:
129+
visibility = int(ret['visibility'])
130+
except (TimeoutError, asyncio.TimeoutError):
131+
pass
131132
value = "{:,} m / {:.2f} SM".format(int(visibility), visibility / const.METERS_IN_SM) \
132133
if visibility < 30000 else "10 km / 6 SM (+)"
133134
value += ("\n\n**Wind**\n"

0 commit comments

Comments
 (0)