Fixed NPE, space property can be null
[idea/community.git] / 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);
       }