Fix onkyo UnboundLocalError (#53793)

audio_information_raw and video_information_raw were in some cases used before being assigned

error: UnboundLocalError: local variable 'video_information_raw' referenced before assignment
pull/53802/head
Andreas Brett 2021-07-31 14:47:51 +02:00 committed by GitHub
parent c6a2e247fe
commit 172769d19c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -319,8 +319,10 @@ class OnkyoDevice(MediaPlayerEntity):
preset_raw = self.command("preset query")
if self._audio_info_supported:
audio_information_raw = self.command("audio-information query")
self._parse_audio_information(audio_information_raw)
if self._video_info_supported:
video_information_raw = self.command("video-information query")
self._parse_video_information(video_information_raw)
if not (volume_raw and mute_raw and current_source_raw):
return
@ -343,9 +345,6 @@ class OnkyoDevice(MediaPlayerEntity):
self._receiver_max_volume * self._max_volume / 100
)
self._parse_audio_information(audio_information_raw)
self._parse_video_information(video_information_raw)
if not hdmi_out_raw:
return
self._attributes[ATTR_VIDEO_OUT] = ",".join(hdmi_out_raw[1])