mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-05 09:53:33 +03:00
Fix "could be None" conditional for call to plug.notify_journal_entry()
In testing the *first* hit on this does have `monitor.cmdr` set, but neither `monitor.system` or `monitor.station`. So: 1. Allow those to be `None` in the function signature, 2. Guard against only `monitor.cmdr` being falsey before the call. 3. Move the `if err:` to the same scope.
This commit is contained in:
parent
5d5b091d2c
commit
5d1eb9e3b1
@ -1457,7 +1457,7 @@ class AppWindow(object):
|
|||||||
and config.get_int('output') & config.OUT_SHIP:
|
and config.get_int('output') & config.OUT_SHIP:
|
||||||
monitor.export_ship()
|
monitor.export_ship()
|
||||||
|
|
||||||
if monitor.cmdr and monitor.system and monitor.station:
|
if monitor.cmdr:
|
||||||
err = plug.notify_journal_entry(
|
err = plug.notify_journal_entry(
|
||||||
monitor.cmdr,
|
monitor.cmdr,
|
||||||
monitor.is_beta,
|
monitor.is_beta,
|
||||||
@ -1467,10 +1467,10 @@ class AppWindow(object):
|
|||||||
monitor.state
|
monitor.state
|
||||||
)
|
)
|
||||||
|
|
||||||
if err:
|
if err:
|
||||||
self.status['text'] = err
|
self.status['text'] = err
|
||||||
if not config.get_int('hotkey_mute'):
|
if not config.get_int('hotkey_mute'):
|
||||||
hotkeymgr.play_bad()
|
hotkeymgr.play_bad()
|
||||||
|
|
||||||
auto_update = False
|
auto_update = False
|
||||||
# Only if auth callback is not pending
|
# Only if auth callback is not pending
|
||||||
|
2
plug.py
2
plug.py
@ -286,7 +286,7 @@ def notify_prefs_changed(cmdr: str | None, is_beta: bool) -> None:
|
|||||||
|
|
||||||
|
|
||||||
def notify_journal_entry(
|
def notify_journal_entry(
|
||||||
cmdr: str, is_beta: bool, system: str, station: str,
|
cmdr: str, is_beta: bool, system: str | None, station: str | None,
|
||||||
entry: MutableMapping[str, Any],
|
entry: MutableMapping[str, Any],
|
||||||
state: Mapping[str, Any]
|
state: Mapping[str, Any]
|
||||||
) -> Optional[str]:
|
) -> Optional[str]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user