Skip to content

extract_message_content: character(0) content triggers vacuous truth in all() #279

@seanthimons

Description

@seanthimons

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 = "")).

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions