homebridge-xbox-tv 2.12.13 → 2.12.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Xbox TV",
3
3
  "name": "homebridge-xbox-tv",
4
- "version": "2.12.13",
4
+ "version": "2.12.14",
5
5
  "description": "Homebridge plugin to control Xbox game consoles.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
package/src/xboxdevice.js CHANGED
@@ -320,7 +320,7 @@ class XboxDevice extends EventEmitter {
320
320
  //read dev info from file
321
321
  try {
322
322
  const data = await fsPromises.readFile(this.devInfoFile);
323
- this.savedInfo = data.length > 0 ? JSON.parse(data) : {};
323
+ this.savedInfo = data.toString().trim() !== '' ? JSON.parse(data) : {};
324
324
  const debug = !this.enableDebugMode ? false : this.emit('debug', `Read saved Info: ${JSON.stringify(this.savedInfo, null, 2)}`);
325
325
  } catch (error) {
326
326
  this.emit('error', `read saved Info error: ${error}`);
@@ -329,7 +329,7 @@ class XboxDevice extends EventEmitter {
329
329
  //read inputs file
330
330
  try {
331
331
  const data = await fsPromises.readFile(this.inputsFile);
332
- this.savedInputs = data.length > 0 ? JSON.parse(data) : this.inputs;
332
+ this.savedInputs = data.toString().trim() !== '' ? JSON.parse(data) : this.inputs;
333
333
  const debug = !this.enableDebugMode ? false : this.emit('debug', `Read saved Inputs: ${JSON.stringify(this.savedInputs, null, 2)}`);
334
334
  } catch (error) {
335
335
  this.emit('error', `read saved Inputs error: ${error}`);
@@ -338,7 +338,7 @@ class XboxDevice extends EventEmitter {
338
338
  //read inputs names from file
339
339
  try {
340
340
  const data = await fsPromises.readFile(this.inputsNamesFile);
341
- this.savedInputsNames = data.length > 0 ? JSON.parse(data) : {};
341
+ this.savedInputsNames = data.toString().trim() !== '' ? JSON.parse(data) : {};
342
342
  const debug = !this.enableDebugMode ? false : this.emit('debug', `Read saved Inputs Names: ${JSON.stringify(this.savedInputsNames, null, 2)}`);
343
343
  } catch (error) {
344
344
  this.emit('error', `read saved Inputs Names error: ${error}`);
@@ -347,7 +347,7 @@ class XboxDevice extends EventEmitter {
347
347
  //read inputs visibility from file
348
348
  try {
349
349
  const data = await fsPromises.readFile(this.inputsTargetVisibilityFile);
350
- this.savedInputsTargetVisibility = data.length > 0 ? JSON.parse(data) : {};
350
+ this.savedInputsTargetVisibility = data.toString().trim() !== '' ? JSON.parse(data) : {};
351
351
  const debug = !this.enableDebugMode ? false : this.emit('debug', `Read saved Inputs Target Visibility: ${JSON.stringify(this.savedInputsTargetVisibility, null, 2)}`);
352
352
  } catch (error) {
353
353
  this.emit('error', `read saved Inputs Target Visibility error: ${error}`);