diff options
| author | Austin Hellyer <[email protected]> | 2016-11-06 12:06:03 -0800 |
|---|---|---|
| committer | Austin Hellyer <[email protected]> | 2016-11-06 12:06:03 -0800 |
| commit | ca55fbf8616c767c5c8593a768d07289731d573a (patch) | |
| tree | 8383a12ad8401f63ee177a0016dc724aa05e9c96 /src | |
| parent | Fix typo in example 06 (diff) | |
| download | serenity-ca55fbf8616c767c5c8593a768d07289731d573a.tar.xz serenity-ca55fbf8616c767c5c8593a768d07289731d573a.zip | |
Fix framework locking on MessageCreate dispatch
The framework will lock on checking if it's initialized, and will not
be able to unlock a second time from within the same scope. Fix this
by unlocking it once and binding it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/dispatch.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/client/dispatch.rs b/src/client/dispatch.rs index 9a7fc2d..92f3624 100644 --- a/src/client/dispatch.rs +++ b/src/client/dispatch.rs @@ -417,13 +417,14 @@ pub fn dispatch(event: Result<Event>, let context = context(Some(event.message.channel_id), conn, login_type); + let mut framework = framework.lock().expect("framework poisoned"); - if framework.lock().unwrap().initialized { + if framework.initialized { dispatch_message(context.clone(), event.message.clone(), event_store); - framework.lock().unwrap().dispatch(context, event.message); + framework.dispatch(context, event.message); } else { dispatch_message(context, event.message, event_store); } |