Check for type and data not being undefined
This commit is contained in:
parent
cfcf815275
commit
4f9f206b42
1 changed files with 4 additions and 3 deletions
|
@ -175,12 +175,13 @@ function gotData(socket,data,UDPSocket){
|
|||
while(data.length>0){
|
||||
let message=new Message;
|
||||
message.load(data.shift());
|
||||
|
||||
|
||||
// In case either `type` or `data` is missing we won't process this message.
|
||||
if (!message.type || !message.data) {
|
||||
if (message.type === undefined || message.data === undefined) {
|
||||
this.log('Message is missing either `type` or `data` property, skipping message.');
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
this.log('received event of : ',message.type,message.data);
|
||||
|
||||
if(message.data.id){
|
||||
|
|
Loading…
Reference in a new issue