From 16ac73d002cd7f810d90fe91d109d7b28f6108f2 Mon Sep 17 00:00:00 2001
From: akwizgran <akwizgran@users.sourceforge.net>
Date: Fri, 16 Sep 2016 22:02:04 +0100
Subject: [PATCH] Don't throw an exception if the client has no delivery hook.

---
 .../src/org/briarproject/sync/ValidationManagerImpl.java      | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/briar-core/src/org/briarproject/sync/ValidationManagerImpl.java b/briar-core/src/org/briarproject/sync/ValidationManagerImpl.java
index c83ee44793..2d4e716a62 100644
--- a/briar-core/src/org/briarproject/sync/ValidationManagerImpl.java
+++ b/briar-core/src/org/briarproject/sync/ValidationManagerImpl.java
@@ -339,9 +339,9 @@ class ValidationManagerImpl implements ValidationManager, Service,
 
 	private boolean deliverMessage(Transaction txn, Message m, ClientId c,
 			Metadata meta) throws DbException {
+		// Deliver the message to the client if it's registered a hook
 		IncomingMessageHook hook = hooks.get(c);
-		if (hook == null) throw new DbException();
-		hook.incomingMessage(txn, m, meta);
+		if (hook != null) hook.incomingMessage(txn, m, meta);
 		// TODO: Find a better way for clients to signal validity, #643
 		if (db.getRawMessage(txn, m.getId()) == null) {
 			db.setMessageState(txn, m.getId(), INVALID);
-- 
GitLab