Skip to content

Commit c06255d

Browse files
authored
Update widget.js
1 parent 45df9b3 commit c06255d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

apps/widsmartbatt/widget.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
2222

2323
function draw() {
2424
let batt=E.getBattery();
25-
let data = require("smartbatt").get();
25+
try {
26+
data = require("smartbatt").get();
27+
} catch (e) {
28+
data.hrsLeft = 0;
29+
}
2630
let hrsLeft=data.hrsLeft;
2731
let days = hrsLeft / 24;
2832

0 commit comments

Comments
 (0)