Fix: fixes a bug that crashed ncspot.
Like mentioned in the corresponding issue by ayushjaipuriyar, ncspot would crash when the queue was empty, shuffled, and played. This commit fixes that, together with some minor clippy fixes.
This commit is contained in:
committed by
Henrik Friedrichsen
parent
be7ed20897
commit
655d663aed
@@ -204,7 +204,7 @@ impl View for CoverView {
|
||||
}
|
||||
});
|
||||
|
||||
let cover_url = self.queue.get_current().map(|t| t.cover_url()).flatten();
|
||||
let cover_url = self.queue.get_current().and_then(|t| t.cover_url());
|
||||
|
||||
if let Some(url) = cover_url {
|
||||
self.draw_cover(url, printer.offset, printer.size);
|
||||
|
||||
@@ -143,6 +143,7 @@ impl Layout {
|
||||
self.get_focussed_stack_mut().map(|stack| stack.pop());
|
||||
}
|
||||
|
||||
#[allow(clippy::borrowed_box)]
|
||||
fn get_current_screen(&self) -> Option<&Box<dyn ViewExt>> {
|
||||
self.focus
|
||||
.as_ref()
|
||||
@@ -168,6 +169,7 @@ impl Layout {
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
#[allow(clippy::borrowed_box)]
|
||||
fn get_top_view(&self) -> Option<&Box<dyn ViewExt>> {
|
||||
let focussed_stack = self.get_focussed_stack();
|
||||
if focussed_stack.map(|s| s.len()).unwrap_or_default() > 0 {
|
||||
|
||||
Reference in New Issue
Block a user