Skip to content

Commit

Permalink
refactor: handle null names for R_igraph_mybracket2_names (#1342)
Browse files Browse the repository at this point in the history
  • Loading branch information
aviator-app[bot] authored Apr 13, 2024
2 parents 9b06810 + c2cdf6a commit 37a9a63
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/rinterface_extra.c
Original file line number Diff line number Diff line change
Expand Up @@ -3725,7 +3725,13 @@ SEXP R_igraph_mybracket2_names(SEXP graph, SEXP pidx1, SEXP pidx2) {
SEXP result;
int idx1=INTEGER(pidx1)[0]-1;
int idx2=INTEGER(pidx2)[0]-1;
result=Rf_duplicate(GET_NAMES(VECTOR_ELT(VECTOR_ELT(graph, idx1), idx2)));

SEXP names = GET_NAMES(VECTOR_ELT(VECTOR_ELT(graph, idx1), idx2));
if (Rf_isNull(names)) {
result = NEW_CHARACTER(0);
} else {
result=Rf_duplicate(names);
}
return result;
}

Expand Down

0 comments on commit 37a9a63

Please sign in to comment.