widgets: Fix tracebacks for events without messages.

We could get submessage events for messages that weren't
in our message store if somebody played with a widget
that was on an "old" message for somebody else.
This commit is contained in:
Steve Howell 2018-05-21 18:58:32 +00:00 committed by Tim Abbott
parent 80a331385e
commit f26e85ded3
1 changed files with 7 additions and 0 deletions

View File

@ -67,6 +67,13 @@ exports.activate = function (in_opts) {
exports.handle_event = function (widget_event) { exports.handle_event = function (widget_event) {
var message = message_store.get(widget_event.message_id); var message = message_store.get(widget_event.message_id);
if (!message) {
// It is common for submessage events to arrive on
// messages that we don't yet have in storage. We
// just ignore them completely here.
return;
}
var events = [widget_event]; var events = [widget_event];
message.widget.handle_events(events); message.widget.handle_events(events);