rubrikinc / wachy

A UI for eBPF-based performance debugging
https://rubrikinc.github.io/wachy/
Other
551 stars 17 forks source link

Unguarded `&self.name_to_symbol.get(&function).unwrap()` can lead to panic #3

Closed fasterit closed 2 years ago

fasterit commented 2 years ago

src/program.rs has

    pub fn get_symbol(&self, function: FunctionName) -> &SymbolInfo {
        &self.name_to_symbol.get(&function).unwrap()
    }

which leads to:

Error: Panic! [v0.1.0-alpha.6] Cause: called Option::unwrap() on a None value Location: src/program.rs:404:45.

when called (by pressing Enter) on a line without symbols available.

viveksjain commented 2 years ago

Thanks for the report, and providing motivation to fix several of my TODOs 😄. There's lots of places error handling needs to be better, but I'm planning to fix it along the way since wachy crashing isn't really the end of the world. I wasn't actually able to reproduce this but in any case should hopefully be fixed.