Fix null dereferencing issue for buttons
This commit is contained in:
parent
609740dc48
commit
eb11d7926c
@ -66,6 +66,7 @@ namespace brick {
|
||||
|
||||
//% hidden
|
||||
_update(curr: boolean) {
|
||||
if (curr === null) return
|
||||
if (this._isPressed == curr) return
|
||||
this._isPressed = curr
|
||||
if (curr) {
|
||||
|
@ -68,7 +68,7 @@ namespace sensors.internal {
|
||||
if (info.sensor) return info.sensor._query()
|
||||
return 0
|
||||
}, (prev, curr) => {
|
||||
if (info.sensor && curr !== null) info.sensor._update(prev, curr)
|
||||
if (info.sensor && curr != null) info.sensor._update(prev, curr)
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user