Fix null ref for this when _update is called.
This commit is contained in:
1 parent
1c81ecd23f
commit
2b5f702bb6
2 files changed
+3
-2
No files matched your search
@@ -66,7 +66,7 @@ namespace brick {
|
||||
|
||||
//% hidden
|
||||
_update(curr: boolean) {
|
||||
if (curr === null) return
|
||||
if (this == null) return
|
||||
if (this._isPressed == curr) return
|
||||
this._isPressed = curr
|
||||
if (curr) {
|
||||
|
||||
+2
-1
@@ -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) info.sensor._update(prev, curr)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -214,6 +214,7 @@ namespace sensors.internal {
|
||||
}
|
||||
|
||||
public setLevel(level: number) {
|
||||
if (this == null) return
|
||||
this.level = this.clampValue(level);
|
||||
|
||||
if (this.level >= this.highThreshold) {
|
||||
|
||||
Reference in new issue
Block a user