src/org/sonews/mlgw/Dispatcher.java
changeset 36 c404a87db5b7
parent 35 ed84c8bdd87b
child 37 74139325d305
     1.1 --- a/src/org/sonews/mlgw/Dispatcher.java	Sun Aug 29 17:28:58 2010 +0200
     1.2 +++ b/src/org/sonews/mlgw/Dispatcher.java	Sun Aug 29 17:43:58 2010 +0200
     1.3 @@ -143,6 +143,11 @@
     1.4     */
     1.5    public static boolean toGroup(final Message msg)
     1.6    {
     1.7 +    if(msg == null)
     1.8 +	{
     1.9 +      throw new IllegalArgumentException("Argument 'msg' must not be null!");
    1.10 +    }
    1.11 +
    1.12      try
    1.13      {
    1.14        // Create new Article object
    1.15 @@ -159,14 +164,17 @@
    1.16        {
    1.17          // Check for duplicate entries of the same group
    1.18          Article oldArticle = StorageManager.current().getArticle(article.getMessageID());
    1.19 -        List<Group> oldGroups = oldArticle.getGroups();
    1.20 -        for(Group oldGroup : oldGroups)
    1.21 -        {
    1.22 -          if(!newsgroups.contains(oldGroup.getName()))
    1.23 +        if(oldArticle != null)
    1.24 +		{
    1.25 +          List<Group> oldGroups = oldArticle.getGroups();
    1.26 +          for(Group oldGroup : oldGroups)
    1.27            {
    1.28 -            oldgroups.add(oldGroup.getName());
    1.29 +            if(!newsgroups.contains(oldGroup.getName()))
    1.30 +            {
    1.31 +              oldgroups.add(oldGroup.getName());
    1.32 +            }
    1.33            }
    1.34 -        }
    1.35 +		}
    1.36        }
    1.37  
    1.38        if(newsgroups.size() > 0)