diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2023-10-04 15:43:31 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2023-10-09 16:38:02 +0200 |
| commit | e1fd11775c7d275dd57d7d9202e88ac5173bbeef (patch) | |
| tree | 6ae817d4a175b5ad3027541133f88590200558f9 /libdino/src/service/blocking_manager.vala | |
| parent | 2c445501a4dc56c4a814f457a4669d79ebce0a57 (diff) | |
| download | dino-e1fd11775c7d275dd57d7d9202e88ac5173bbeef.tar.gz | |
Check XmppStream against null
Most of the calls to stream_interactor.get_stream(account) were already
doing null checks, but there were still some missing.
Diffstat (limited to 'libdino/src/service/blocking_manager.vala')
| -rw-r--r-- | libdino/src/service/blocking_manager.vala | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/libdino/src/service/blocking_manager.vala b/libdino/src/service/blocking_manager.vala index aa07f990..4e26b001 100644 --- a/libdino/src/service/blocking_manager.vala +++ b/libdino/src/service/blocking_manager.vala @@ -21,22 +21,26 @@ public class BlockingManager : StreamInteractionModule, Object { } public bool is_blocked(Account account, Jid jid) { - XmppStream stream = stream_interactor.get_stream(account); + XmppStream? stream = stream_interactor.get_stream(account); return stream != null && stream.get_module(Xmpp.Xep.BlockingCommand.Module.IDENTITY).is_blocked(stream, jid.to_string()); } public void block(Account account, Jid jid) { - XmppStream stream = stream_interactor.get_stream(account); - stream.get_module(Xmpp.Xep.BlockingCommand.Module.IDENTITY).block(stream, { jid.to_string() }); + XmppStream? stream = stream_interactor.get_stream(account); + if (stream != null) { + stream.get_module(Xmpp.Xep.BlockingCommand.Module.IDENTITY).block(stream, { jid.to_string() }); + } } public void unblock(Account account, Jid jid) { - XmppStream stream = stream_interactor.get_stream(account); - stream.get_module(Xmpp.Xep.BlockingCommand.Module.IDENTITY).unblock(stream, { jid.to_string() }); + XmppStream? stream = stream_interactor.get_stream(account); + if (stream != null) { + stream.get_module(Xmpp.Xep.BlockingCommand.Module.IDENTITY).unblock(stream, { jid.to_string() }); + } } public bool is_supported(Account account) { - XmppStream stream = stream_interactor.get_stream(account); + XmppStream? stream = stream_interactor.get_stream(account); return stream != null && stream.get_module(Xmpp.Xep.BlockingCommand.Module.IDENTITY).is_supported(stream); } } |
