Fix NPE on Gerrit startup if mail.from doesn't include a name

If for mail.from in the gerrit.config only an e-mail address but no
name was set, Gerrit failed on startup with a NullPointerException.

Bug: issue 961
Change-Id: Ie99a6c7ae42d77e408bc624408b2d13c8b5f9797
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin 2011-05-20 08:00:09 +02:00
parent b052ca8dcf
commit c771cd5c7a
1 changed files with 2 additions and 2 deletions

View File

@ -52,8 +52,8 @@ public class FromAddressGeneratorProvider implements
} else {
final Address a = Address.parse(from);
final ParamertizedString name = new ParamertizedString(a.name);
if (name.getParameterNames().isEmpty()) {
final ParamertizedString name = a.name != null ? new ParamertizedString(a.name) : null;
if (name == null || name.getParameterNames().isEmpty()) {
generator = new ServerGen(a);
} else {
generator = new PatternGen(srvAddr, accountCache, name, a.email);