server: fix state nre

This commit is contained in:
Koushik Dutta
2021-11-23 23:39:16 -05:00
parent 6af4efb411
commit 82afbc1003
2 changed files with 1 additions and 5 deletions

View File

@@ -29,10 +29,6 @@ import { Alerts } from './services/alerts';
import { Info } from './services/info';
import io from 'engine.io';
import {spawn as ptySpawn} from 'node-pty';
import child_process from 'child_process';
import fs from 'fs';
import path from 'path';
import { ensurePluginVolume } from './plugin/plugin-volume';
interface DeviceProxyPair {
handler: PluginDeviceProxyHandler;

View File

@@ -236,7 +236,7 @@ export function setState(pluginDevice: PluginDevice, property: string, value: an
}
export function getState(pluginDevice: PluginDevice, property: string): any {
const ret = pluginDevice.state[property]?.value;
const ret = pluginDevice.state?.[property]?.value;
if (typeof ret === 'object')
return JSON.parse(JSON.stringify(ret));
return ret;