diff src/org/tmatesoft/hg/repo/HgDirstate.java @ 332:72c6eda838a6

NPE in HgDirstate.known() when no dirstate file present
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 09 Nov 2011 04:33:44 +0100
parents 981f9f50bb6c
children a0864b2892cd
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgDirstate.java	Sat Nov 05 04:21:18 2011 +0100
+++ b/src/org/tmatesoft/hg/repo/HgDirstate.java	Wed Nov 09 04:33:44 2011 +0100
@@ -75,6 +75,11 @@
 
 	private void read() {
 		normal = added = removed = merged = Collections.<Path, Record>emptyMap();
+		if (canonicalPathRewrite != null) {
+			canonical2dirstateName = new HashMap<Path,Path>();
+		} else {
+			canonical2dirstateName = Collections.emptyMap();
+		}
 		if (dirstateFile == null || !dirstateFile.exists()) {
 			return;
 		}
@@ -87,11 +92,6 @@
 		added = new LinkedHashMap<Path, Record>();
 		removed = new LinkedHashMap<Path, Record>();
 		merged = new LinkedHashMap<Path, Record>();
-		if (canonicalPathRewrite != null) {
-			canonical2dirstateName = new HashMap<Path,Path>();
-		} else {
-			canonical2dirstateName = Collections.emptyMap();
-		}
 		try {
 			parents = internalReadParents(da);
 			// hg init; hg up produces an empty repository where dirstate has parents (40 bytes) only