From 4b97be897ed0bb118c758cf97a1464d377c7b5e0 Mon Sep 17 00:00:00 2001 From: akwizgran <akwizgran@users.sourceforge.net> Date: Mon, 19 Sep 2011 16:25:49 +0100 Subject: [PATCH] Don't attempt to retrieve ratings for anonymous messages. --- components/net/sf/briar/db/DatabaseComponentImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/net/sf/briar/db/DatabaseComponentImpl.java b/components/net/sf/briar/db/DatabaseComponentImpl.java index 66fe5dc1c8..f864b88978 100644 --- a/components/net/sf/briar/db/DatabaseComponentImpl.java +++ b/components/net/sf/briar/db/DatabaseComponentImpl.java @@ -218,6 +218,7 @@ DatabaseCleaner.Callback { * the sender and unseen by all other contacts, and returns true. * <p> * Locking: contacts read, messages write, messageStatuses write. + * @param sender may be null for a locally generated message. */ private boolean storeGroupMessage(T txn, Message m, ContactId sender) throws DbException { @@ -251,7 +252,8 @@ DatabaseCleaner.Callback { private int calculateSendability(T txn, Message m) throws DbException { int sendability = 0; // One point for a good rating - if(db.getRating(txn, m.getAuthor()) == Rating.GOOD) sendability++; + AuthorId a = m.getAuthor(); + if(a != null && db.getRating(txn, a) == Rating.GOOD) sendability++; // One point per sendable child (backward inclusion) sendability += db.getNumberOfSendableChildren(txn, m.getId()); return sendability; -- GitLab