# HG changeset patch
# User Artem Tikhomirov <tikhomirov.artem@gmail.com>
# Date 1373635777 -7200
# Node ID 002ed1b2baad7c302d9191ca9bede778ee6f9622
# Parent  52af7f62e731a335fa88e79463faa6799fd41dcb
AIOOBE in BundleGenerator.ChunkGenerator.iterate when there are no outgoing changes on push

diff -r 52af7f62e731 -r 002ed1b2baad src/org/tmatesoft/hg/core/HgPushCommand.java
--- a/src/org/tmatesoft/hg/core/HgPushCommand.java	Fri Jul 12 15:27:43 2013 +0200
+++ b/src/org/tmatesoft/hg/core/HgPushCommand.java	Fri Jul 12 15:29:37 2013 +0200
@@ -87,13 +87,14 @@
 			} else {
 				outgoing = new RevisionSet(l);
 			}
+			HgBundle b = null;
 			if (!outgoing.isEmpty()) {
 				//
 				// prepare bundle
 				BundleGenerator bg = new BundleGenerator(implRepo);
 				File bundleFile = bg.create(outgoing.asList());
 				progress.worked(20);
-				HgBundle b = new HgLookup(repo.getSessionContext()).loadBundle(bundleFile);
+				b = new HgLookup(repo.getSessionContext()).loadBundle(bundleFile);
 				//
 				// send changes
 				remoteRepo.unbundle(b, comparator.getRemoteHeads());
@@ -137,7 +138,9 @@
 			}
 			// XXX WTF is obsolete in namespaces key??
 			progress.worked(5);
-			b.unlink(); // keep the file only in case of failure
+			if (b != null) {
+				b.unlink(); // keep the file only in case of failure
+			}
 		} catch (IOException ex) {
 			throw new HgIOException(ex.getMessage(), null); // XXX not a nice idea to throw IOException from BundleGenerator#create
 		} catch (HgRepositoryNotFoundException ex) {