2.11.0-M5-git-17: prevent (rare) null-pointer exception on deletePage
Null-Pointer exception may occur on  when pages are not indexed yet .  This occurs sometimes on running the CommandResolveTest tear-down.
@@ -2042,6 +2042,7 @@ public class WikiEngine
else
{
Collection<String> refTo = m_referenceManager.findRefersTo(pageName);
+ //May return null, if the page does not exist or has not been indexed yet.
if (m_attachmentManager.hasAttachments( p ))
{
@@ -2049,7 +2050,8 @@ public class WikiEngine
for( Iterator< Attachment > atti = attachments.iterator(); atti.hasNext(); )
{
Attachment attachment = atti.next();
- refTo.remove(attachment.getName());
+
+ if( refTo != null ) refTo.remove(attachment.getName());
m_attachmentManager.deleteAttachment( attachment );
}
