Fix panic when only setting bold and redirecting stdout. (#498)

This commit is contained in:
David Sherret 2020-10-28 16:29:01 -04:00 committed by GitHub
parent 6d0590454f
commit 901070f138
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,10 +70,10 @@ pub(crate) fn set_background_color(bg_color: Color) -> Result<()> {
} }
pub(crate) fn reset() -> Result<()> { pub(crate) fn reset() -> Result<()> {
let original_color = original_console_color(); if let Some(original_color) = *ORIGINAL_CONSOLE_COLOR.lock().unwrap() {
Console::from(Handle::new(HandleType::CurrentOutputHandle)?) Console::from(Handle::new(HandleType::CurrentOutputHandle)?)
.set_text_attribute(original_color)?; .set_text_attribute(original_color)?;
}
Ok(()) Ok(())
} }