Fix Jingle connection code when cancellable is null

This commit is contained in:
hrxi 2019-08-09 14:46:12 +02:00
parent 6494d7a45d
commit 34d7b5f515

View file

@ -838,12 +838,17 @@ public class Connection : IOStream {
return; return;
} }
SourceFunc callback = wait_and_check_for_errors.callback; SourceFunc callback = wait_and_check_for_errors.callback;
ulong id = cancellable.connect(() => callback()); ulong id = 0;
if (cancellable != null) {
id = cancellable.connect(() => callback());
}
callbacks.add(new OnSetInnerCallback() { callback=(owned)callback, io_priority=io_priority}); callbacks.add(new OnSetInnerCallback() { callback=(owned)callback, io_priority=io_priority});
yield; yield;
if (cancellable != null) {
cancellable.disconnect(id); cancellable.disconnect(id);
} }
} }
}
private void handle_connection_error(IOError error) { private void handle_connection_error(IOError error) {
Session? strong = session; Session? strong = session;
if (strong != null) { if (strong != null) {