Skip to content

Commit 43848d7

Browse files
author
Jakub Szwacz
committed
Validate incoming message format
1 parent 1218b49 commit 43848d7

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/communication/handlers.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ filepicker.extend('handlers', function(){
66
var storage = {};
77

88
var attachHandler = function(id, handler){
9-
if (storage.hasOwnProperty(id)){
9+
if (storage.hasOwnProperty(id)){
1010
storage[id].push(handler);
1111
} else {
1212
storage[id] = [handler];
@@ -36,8 +36,11 @@ filepicker.extend('handlers', function(){
3636
};
3737

3838
var run = function(data){
39+
if (data == null || data.id == null || data.type == null) {
40+
return false;
41+
}
3942
var callerId = data.id;
40-
if (storage.hasOwnProperty(callerId)){
43+
if (storage.hasOwnProperty(callerId)){
4144
//have to grab first in case someone removes mid-go
4245
var handlers = storage[callerId];
4346
for (var i = 0; i < handlers.length; i++) {

0 commit comments

Comments
 (0)