Skip to content

Fix unreachable code in URL output handler #19056

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cla7aye15I4nd
Copy link

Description

This PR fixes a logical issue in the URL output handler where the final else branch was unreachable due to redundant conditionals.

Problem

The existing code had the following structure:

if (ZSTR_LEN(url_state->url_app.s) != 0) {
    // handle non-empty case
} else if (ZSTR_LEN(url_state->url_app.s) == 0) {
    // handle empty case  
} else {
    // unreachable branch
    *handled_output = NULL;
}

Since ZSTR_LEN() returns a size_t (unsigned integer), the value can only be either "not equal to 0" or "equal to 0". The third else branch was unreachable, making the *handled_output = NULL; assignment dead code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant