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,10 +838,15 @@ 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;
cancellable.disconnect(id); if (cancellable != null) {
cancellable.disconnect(id);
}
} }
} }
private void handle_connection_error(IOError error) { private void handle_connection_error(IOError error) {