Fixed possible NPE

This commit is contained in:
Andrey Vlasovskikh
2013-08-02 12:41:13 +04:00
parent f0222e8fa3
commit afd5c68804
@@ -63,7 +63,7 @@ public class PyTypeCheckerInspection extends PyInspection {
final PyExpression source = node.getForPart().getSource();
if (source != null) {
final PyType type = myTypeEvalContext.getType(source);
if (!PyTypeChecker.isUnknown(type) && !PyABCUtil.isSubtype(type, PyNames.ITERABLE)) {
if (type != null && !PyTypeChecker.isUnknown(type) && !PyABCUtil.isSubtype(type, PyNames.ITERABLE)) {
registerProblem(source, String.format("Expected 'collections.Iterable', got '%s' instead",
PythonDocumentationProvider.getTypeName(type, myTypeEvalContext)));
}