Skip to content

Commit aa6a815

Browse files
committed
Fix network sending and add sanity checks
1 parent 61dd242 commit aa6a815

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/data.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,10 @@ export class Container extends Sink {
319319
}
320320

321321
startApp(time, x, y, width, height, id, sha, appid) {
322+
if (typeof id !== 'string') return
323+
if (typeof sha !== 'string') return
324+
if (typeof appid !== 'string') return
325+
322326
const buflength = sha.length / 2 // it is hex coded so two bytes per byte
323327
if (buflength !== 32) {
324328
console.log('sha not equal 256 bits!', sha, buflength)
@@ -1631,7 +1635,7 @@ export class NetworkSink extends Sink {
16311635
}
16321636

16331637
startApp(time, x, y, width, height, id, sha, appid) {
1634-
return {
1638+
this.sendfunc({
16351639
task: 'startApp',
16361640
time,
16371641
x,
@@ -1641,22 +1645,22 @@ export class NetworkSink extends Sink {
16411645
id,
16421646
sha,
16431647
appid
1644-
}
1648+
})
16451649
}
16461650

16471651
closeApp(time) {
1648-
return {
1652+
this.sendfunc({
16491653
task: 'closeApp',
16501654
time
1651-
}
1655+
})
16521656
}
16531657

16541658
dataApp(time, buffer) {
1655-
return {
1659+
this.sendfunc({
16561660
task: 'dataApp',
16571661
time,
16581662
buffer
1659-
}
1663+
})
16601664
}
16611665

16621666
moveApp(time, x, y, width, height, deactivate) {

0 commit comments

Comments
 (0)