QEDK / configparser-rs

A simple configuration parsing utility with no dependencies built on Rust.
https://crates.io/crates/configparser
Other
66 stars 21 forks source link

Panic when multiline enabled due to unwrap #39

Closed ScottCUSA closed 1 year ago

ScottCUSA commented 1 year ago

configparser can cause a panic on write if multiline is enabled and value is an empty string.

thread 'main' panicked at 'called Option::unwrap() on a None value', .../.cargo/registry/src/index.crates.io-6f17d22bba15001f/configparser-3.0.2/src/ini.rs:421:51

ScottCUSA commented 1 year ago

I think, out.push_str(lines.next().unwrap());, could be changed to,out.push_str(lines.next().unwrap_or(""));, or out.push_str(lines.next().unwrap_or_default()); to resolve this issue.

QEDK commented 1 year ago

Good catch, will be fixed in the next release!