From c0450583bd66fa6781a1814da151ef6ba3ac249a Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 2 Jul 2013 23:00:07 +0200 Subject: [PATCH] fix NPE during IElementType.enumerate --- platform/core-api/src/com/intellij/psi/tree/IElementType.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/core-api/src/com/intellij/psi/tree/IElementType.java b/platform/core-api/src/com/intellij/psi/tree/IElementType.java index 1212d5dc8465..b64d76112220 100644 --- a/platform/core-api/src/com/intellij/psi/tree/IElementType.java +++ b/platform/core-api/src/com/intellij/psi/tree/IElementType.java @@ -194,8 +194,8 @@ public class IElementType { IElementType[] copy; ourRegistryReadLock.lock(); try { - copy = new IElementType[ourCounter]; - System.arraycopy(ourRegistry, 0, copy, 0, ourCounter); + copy = new IElementType[ourCounter - FIRST_TOKEN_INDEX]; + System.arraycopy(ourRegistry, 0, copy, 0, ourCounter - FIRST_TOKEN_INDEX); } finally { ourRegistryReadLock.unlock(); }