src/ldDocument.cc

changeset 866
4951b737f8cb
parent 863
238082c94304
child 867
557cb07dbe57
--- a/src/ldDocument.cc	Sat Aug 30 16:08:05 2014 +0300
+++ b/src/ldDocument.cc	Sat Aug 30 20:09:30 2014 +0300
@@ -226,10 +226,15 @@
 //
 LDDocumentPtr FindDocument (QString name)
 {
-	for (LDDocumentWeakPtr file : g_allDocuments)
+	for (LDDocumentWeakPtr weakfile : g_allDocuments)
 	{
-		if (file != null and file.toStrongRef()->name() == name)
-			return file.toStrongRef();
+		if (weakfile == null)
+			continue;
+
+		LDDocumentPtr file (weakfile.toStrongRef());
+
+		if (Eq (name, file->name(), file->defaultName()))
+			return file;
 	}
 
 	return LDDocumentPtr();

mercurial