Fixed NPE, space property can be null
authorYaroslav Lepenkin <yaroslav.lepenkin@jetbrains.com>
Tue, 7 Jul 2015 13:28:06 +0000 (16:28 +0300)
committerYaroslav Lepenkin <yaroslav.lepenkin@jetbrains.com>
Tue, 7 Jul 2015 14:24:10 +0000 (17:24 +0300)
platform/lang-impl/src/com/intellij/formatting/FormatProcessor.java

index 5b6d1d00e53980f1c4be47995f29f509d7ff6dae..b4e7c5be552eea8ff0b4b8b63cbe6ae3ab777775 100644 (file)
@@ -475,7 +475,7 @@ public class FormatProcessor {
     final WhiteSpace whiteSpace = myCurrentBlock.getWhiteSpace();
 
     if (isReformatSelectedRangesContext()) {
-      if (isCurrentBlockAlignmentUsedInRangesToModify() && whiteSpace.isReadOnly() && !spaceProperty.isReadOnly()) {
+      if (isCurrentBlockAlignmentUsedInRangesToModify() && whiteSpace.isReadOnly() && spaceProperty != null && !spaceProperty.isReadOnly()) {
         whiteSpace.setReadOnly(false);
         whiteSpace.setLineFeedsAreReadOnly(true);
       }