Bug 499000 - BasicIndexOutOfBoundsException below
CommandStackListener.getHistory

* Make sure that history resource actually contains a history

Change-Id: I83c68e8f51730298a1641bf5ce832b19c95341a3
Signed-off-by: Johannes Faltermeier <jfaltermeier@eclipsesource.com>
diff --git a/plugins/org.eclipse.emf.edapt.history.edit/src/org/eclipse/emf/edapt/history/recorder/EditingDomainListener.java b/plugins/org.eclipse.emf.edapt.history.edit/src/org/eclipse/emf/edapt/history/recorder/EditingDomainListener.java
index cee0971..efeec28 100644
--- a/plugins/org.eclipse.emf.edapt.history.edit/src/org/eclipse/emf/edapt/history/recorder/EditingDomainListener.java
+++ b/plugins/org.eclipse.emf.edapt.history.edit/src/org/eclipse/emf/edapt/history/recorder/EditingDomainListener.java
@@ -135,6 +135,12 @@
 		try {
 			historyResource.load(null);
 			EcoreUtil.resolveAll(historyResource);
+			if (historyResource.getContents().isEmpty()) {
+				return false;
+			}
+			if (!History.class.isInstance(historyResource.getContents().get(0))) {
+				return false;
+			}
 			return true;
 		} catch (final IOException e) {
 			resourceSet.getResources().remove(historyResource);