Commit d0458173 authored by Raymond Toy's avatar Raymond Toy Committed by Commit Bot

Access the rendered buffer only if the document exists

When firing the completion event make sure the document exists before
we try to get the rendered buffer that needs to be returned.

Bug: 751377
Change-Id: Id956f5a287b6b91b7bad04d85b6c8f3c32c9470d
Reviewed-on: https://chromium-review.googlesource.com/598727Reviewed-by: default avatarHongchan Choi <hongchan@chromium.org>
Commit-Queue: Hongchan Choi <hongchan@chromium.org>
Commit-Queue: Raymond Toy <rtoy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491527}
parent 3305344c
...@@ -353,14 +353,14 @@ void OfflineAudioContext::FireCompletionEvent() { ...@@ -353,14 +353,14 @@ void OfflineAudioContext::FireCompletionEvent() {
// that the context has been closed. // that the context has been closed.
SetContextState(kClosed); SetContextState(kClosed);
AudioBuffer* rendered_buffer = DestinationHandler().RenderTarget();
DCHECK(rendered_buffer);
if (!rendered_buffer)
return;
// Avoid firing the event if the document has already gone away. // Avoid firing the event if the document has already gone away.
if (GetExecutionContext()) { if (GetExecutionContext()) {
AudioBuffer* rendered_buffer = DestinationHandler().RenderTarget();
DCHECK(rendered_buffer);
if (!rendered_buffer)
return;
// Call the offline rendering completion event listener and resolve the // Call the offline rendering completion event listener and resolve the
// promise too. // promise too.
DispatchEvent(OfflineAudioCompletionEvent::Create(rendered_buffer)); DispatchEvent(OfflineAudioCompletionEvent::Create(rendered_buffer));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment