Source: PR #278 review (round 1)
Severity: MEDIUM
File: R/api_openrouter.R:93
all(nchar(character(0)) == 0) returns TRUE in R (vacuous truth). If content is a zero-length character vector (possible from JSON deserializers), the function falls into the reasoning branch. If reasoning is also NULL, it returns NULL which may cause downstream errors.
Suggested fix: Add length(content) == 0 || before the all() call, or use !nzchar(paste(content, collapse = "")).
Source: PR #278 review (round 1)
Severity: MEDIUM
File:
R/api_openrouter.R:93all(nchar(character(0)) == 0)returnsTRUEin R (vacuous truth). Ifcontentis a zero-length character vector (possible from JSON deserializers), the function falls into the reasoning branch. If reasoning is also NULL, it returns NULL which may cause downstream errors.Suggested fix: Add
length(content) == 0 ||before theall()call, or use!nzchar(paste(content, collapse = "")).