Skip to content

Commit 2511c0d

Browse files
committed
avoid strange exceptions
1 parent 2e1cfc7 commit 2511c0d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

soot-infoflow/src/soot/jimple/infoflow/problems/BackwardsInfoflowProblem.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,17 +318,19 @@ else if (defStmt.getRightOp() instanceof LengthExpr) {
318318
targetType = TypeUtils.buildArrayOrAddDimension(targetType,
319319
arrayRef.getType().getArrayType());
320320
} else if (leftValue instanceof ArrayRef) {
321-
assert source.getAccessPath().getBaseType() instanceof ArrayType;
322-
targetType = ((ArrayType) targetType).getElementType();
323-
324321
// If we have a type of java.lang.Object, we try
325322
// to tighten it
326323
if (TypeUtils.isObjectLikeType(targetType))
327324
targetType = rightValue.getType();
325+
else if (targetType instanceof ArrayType)
326+
targetType = ((ArrayType) targetType).getElementType();
327+
else
328+
targetType = null;
328329

329330
// If the types do not match, the right side
330331
// cannot be an alias
331-
if (!manager.getTypeUtils().checkCast(rightValue.getType(), targetType))
332+
if (targetType != null
333+
&& !manager.getTypeUtils().checkCast(rightValue.getType(), targetType))
332334
addRightValue = false;
333335
}
334336
}

0 commit comments

Comments
 (0)