From c048e03d03775c068996444eca7ebeeccd1d92fd Mon Sep 17 00:00:00 2001 From: Barney Huang Date: Wed, 11 Jul 2018 06:50:32 -0700 Subject: [PATCH] fix null variable in state Summary: Fix "Cannot read property 'monitoring' of null" in CPU plugin. {F132280986} Reviewed By: danielbuechele Differential Revision: D8800114 fbshipit-source-id: c363eda71e4d580fdd12ff1dc3981feaaafeae93 --- src/device-plugins/cpu/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/device-plugins/cpu/index.js b/src/device-plugins/cpu/index.js index 5d0f83e48..4cf679852 100644 --- a/src/device-plugins/cpu/index.js +++ b/src/device-plugins/cpu/index.js @@ -104,13 +104,13 @@ export default class CPUFrequencyTable extends SonarDevicePlugin { intervalID: ?IntervalID; device: AndroidDevice; - init() { - this.setState({ - cpuFreq: [], - cpuCount: 0, - monitoring: false, - }); + state = { + cpuFreq: [], + cpuCount: 0, + monitoring: false, + }; + init() { this.adbClient = this.device.adb; // check how many cores we have on this device