jeaye/ncurses-rs

tigetstr wrapper is unsafe & provides no way to check for failures

swolchok opened this issue · 2 comments

A simple attempt to use it segfaults:

fn main() {
    let capability = tigetstr("idontexist");
    if capability.is_empty() {
        println!("empty");
    } else {
        println!("nonempty");
    }
}

tigetstr returns (char *)-1 if the capability doesn't exist, and a null pointer if the capability isn't supported. Neither one seems to be supported by the ncurses-rs wrapper.

jeaye commented

Thanks for reporting this! Have you worked around it or patched it up? A PR would be most appreciated.

My workaround was to switch to the term crate, sorry.