8000 Bangle.js2: Fix 2v22 regression where `E.showMenu({test:{}})` would d… · espruino/Espruino@9f82380 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9f82380

Browse files
committed
Bangle.js2: Fix 2v22 regression where E.showMenu({test:{}}) would display 'test:undefined'
1 parent baa571d commit 9f82380

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
Debugger now uses jslPrintPosition to print file+line+col, is aware of Modules.addCached that IDE adds and discounts it
1616
Fix Math.sin on negative numbers on extremely constrained builds (Bangle.js 1/Microbit) where we have to use a very small sin implementation
1717
Bangle.js2: Calling Bangle.getPressure() while a conversion is in progress now returns the same promise (so it will complete as soon as pressure data is ready) rather than erroring
18+
Bangle.js2: Fix 2v22 regression where `E.showMenu({test:{}})` would display 'test:undefined'
1819

1920
2v26 : nRF5x: ensure TIMER1_IRQHandler doesn't always wake idle loop up (fix #1900)
2021
Puck.js: On v2.1 ensure Puck.mag behaves like other variants - just returning the last reading (avoids glitches when used with Puck.magOn)

libs/js/banglejs/E_showMenu_Q3.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,11 @@
123123
if ("object" == typeof item) {
124124
var v = item.value;
125125
if (item.format) v=item.format(v);
126-
var val = g.findFont(v, {w:r.w/2,h:r.h,wrap:1,trim:1});
127-
g.setFontAlign(1,0).drawString(val.text,r.x+r.w-8,2+r.y+H/2);
128-
pad += g.stringWidth(val.text);
126+
if (v!==undefined) {
127+
var val = g.findFont(v, {w:r.w/2,h:r.h,wrap:1,trim:1});
128+
g.setFontAlign(1,0).drawString(val.text,r.x+r.w-8,2+r.y+H/2);
129+
pad += g.stringWidth(val.text);
130+
}
129131
} else if ("function" == typeof item) {
130132
g.drawImage(/* 9x18 */atob("CRKBAGA4Hg8DwPB4HgcDg8PB4eHg8HAwAA=="), r.x+r.w-21, r.y+H/2-9);
131133
pad += 16;

libs/js/banglejs/E_showMenu_Q3.min.js

7 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)
0