Index: third_party/WebKit/Source/modules/webmidi/MIDIInput.cpp |
diff --git a/third_party/WebKit/Source/modules/webmidi/MIDIInput.cpp b/third_party/WebKit/Source/modules/webmidi/MIDIInput.cpp |
index e006b9ceb4d14567167c6a4607dae3917a431507..030d2d260177352e3049481a85c4deb310d5fa76 100644 |
--- a/third_party/WebKit/Source/modules/webmidi/MIDIInput.cpp |
+++ b/third_party/WebKit/Source/modules/webmidi/MIDIInput.cpp |
@@ -90,8 +90,10 @@ void MIDIInput::didReceiveMIDIData(unsigned portIndex, const unsigned char* data |
// unless the current process has an explicit permission to handle sysex message. |
if (data[0] == 0xf0 && !midiAccess()->sysexEnabled()) |
return; |
- RefPtr<DOMUint8Array> array = DOMUint8Array::create(data, length); |
- dispatchEvent(MIDIMessageEvent::create(timeStamp, array)); |
+ RefPtr<DOMUint8Array> array = DOMUint8Array::createOrNull(data, length); |
+ // Silently fail if array allocation failed (out of memory). |
+ if (array) |
+ dispatchEvent(MIDIMessageEvent::create(timeStamp, array.release())); |
} |
DEFINE_TRACE(MIDIInput) |