Index: third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp |
diff --git a/third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp b/third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp |
index 9ea9e0dfdf9266329deb5761592abde71230d524..cf4010bcb93de89cc2963f335f6f4bf3230c7f42 100644 |
--- a/third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp |
+++ b/third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp |
@@ -215,7 +215,11 @@ void MIDIOutput::send(Vector<unsigned> unsignedData, double timestamp, Exception |
if (timestamp == 0.0) |
timestamp = now(executionContext()); |
- RefPtr<DOMUint8Array> array = DOMUint8Array::create(unsignedData.size()); |
+ RefPtr<DOMUint8Array> array = DOMUint8Array::createOrNull(unsignedData.size()); |
+ if (!array) { |
+ exceptionState.throwRangeError("Out of memory."); |
+ return; |
+ } |
DOMUint8Array::ValueType* const arrayData = array->data(); |
const uint32_t arrayLength = array->length(); |