Skip to content

Commit

Permalink
Fix crashes (#61)
Browse files Browse the repository at this point in the history
* fix for possible crash
  • Loading branch information
LeLunZ authored Jun 3, 2024
1 parent a747fdd commit 5cbebd8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/platformAccessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export class HiSenseTVAccessory {
setInterval(() => {
this.checkTVStatus();
}, 10000);

}

async getOn(): Promise<CharacteristicValue> {
Expand Down Expand Up @@ -236,6 +235,7 @@ export class HiSenseTVAccessory {
this.platform.log.debug('Fetching input sources...');
if (!this.deviceState.isConnected) {
this.platform.log.info('Unable to fetch input sources because the TV is off. Will retry as soon as the device comes back online.');
this.deviceState.hasFetchedInputs = false;
return;
}

Expand Down Expand Up @@ -279,6 +279,7 @@ export class HiSenseTVAccessory {
this.getCurrentInput();
} catch (error) {
this.platform.log.error('An error occurred while fetching inputs: ' + error);
this.deviceState.hasFetchedInputs = false;
}
}

Expand Down Expand Up @@ -327,6 +328,7 @@ export class HiSenseTVAccessory {
socket.destroy();

if (!this.deviceState.hasFetchedInputs) {
this.deviceState.hasFetchedInputs = true;
this.getSources();
} else {
this.getCurrentInput();
Expand Down

0 comments on commit 5cbebd8

Please sign in to comment.