Commit 3d802075 authored by Hixie's avatar Hixie

Assert binding ready before getting a11y listener

This adds an assert to verify that we have already got a binding when we
get a semantics listener. Otherwise we crash. (I mean, we still crash,
but now in checked mode we crash on an assert instead. Progress?)
parent 1568b827
......@@ -349,8 +349,10 @@ class SemanticsNode extends AbstractNode {
static bool get hasListeners => _listeners != null && _listeners.length > 0;
static VoidCallback onSemanticsEnabled; // set by the binding
static void addListener(mojom.SemanticsListener listener) {
if (!hasListeners)
if (!hasListeners) {
assert(onSemanticsEnabled != null); // initialise the binding _before_ adding listeners
onSemanticsEnabled();
}
_listeners ??= <mojom.SemanticsListener>[];
_listeners.add(listener);
}
......
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