Fixed bug where we could accidently call a callback twice. (#43467)

This commit is contained in:
gaaclarke
2019-10-29 16:04:38 -07:00
committed by GitHub
parent 05c3f7b6a1
commit 53dcf92f7d
3 changed files with 45 additions and 2 deletions

View File

@@ -82,6 +82,7 @@ class _PlatformBinaryMessenger extends BinaryMessenger {
response = await handler(data);
} else {
ui.channelBuffers.push(channel, data, callback);
callback = null;
}
} catch (exception, stack) {
FlutterError.reportError(FlutterErrorDetails(
@@ -91,7 +92,9 @@ class _PlatformBinaryMessenger extends BinaryMessenger {
context: ErrorDescription('during a plugin platform message call'),
));
} finally {
callback(response);
if (callback != null) {
callback(response);
}
}
}