Skip to content

Commit

Permalink
Fix rare NPE and IOOBE in writing
Browse files Browse the repository at this point in the history
  • Loading branch information
jaskarth committed Dec 8, 2024
1 parent b0ec180 commit 6281238
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,7 @@ public TextBuffer appendParamList(int indent) {
BitSet setAmbiguousParameters = getAmbiguousParameters(matches);

// omit 'new Type[] {}' for the last parameter of a vararg method call
if (lstParameters.size() == descriptor.params.length && isVarArgCall()) {
if (lstParameters.size() == descriptor.params.length && isVarArgCall() && !lstParameters.isEmpty()) {
Exprent lastParam = lstParameters.get(lstParameters.size() - 1);
if (lastParam instanceof NewExprent && lastParam.getExprType().arrayDim >= 1) {
((NewExprent) lastParam).setVarArgParam(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ private void setLambdaGenericTypes() {
VarType curType = methodWrapper.varproc.getVarType(vpp);
VarType infType = desc.getSignature().parameterTypes.get(j++).remap(tempMap);

if (infType != null && !infType.equals(VarType.VARTYPE_VOID)) {
if (infType != null && !infType.equals(VarType.VARTYPE_VOID) && curType != null) {
if (!curType.equals(infType) || (infType.isGeneric() && !((GenericType)infType).equalsExact(curType))) {
methodWrapper.varproc.setVarType(vpp, infType);
String paramName = methodWrapper.varproc.getVarName(vpp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public VarNamesCollector getVarNamesCollector() {
return varNamesCollector;
}

public VarType getVarType(VarVersionPair pair) {
public @Nullable VarType getVarType(VarVersionPair pair) {
return varVersions == null ? null : varVersions.getVarType(pair);
}

Expand Down

0 comments on commit 6281238

Please sign in to comment.