fix crash on end of playlist
apparently playlist_pos() can and will change from >0 to -1 between those two queries
This commit is contained in:
parent
ab96330fbd
commit
f8b47ca9b6
1 changed files with 10 additions and 12 deletions
|
@ -518,18 +518,16 @@ mod imp {
|
|||
}
|
||||
|
||||
fn song(&self) -> Option<Song> {
|
||||
if self.obj().playlist_pos() < 0 {
|
||||
None
|
||||
} else {
|
||||
let song: Song = self
|
||||
.obj()
|
||||
.playlist_model()
|
||||
.item(self.obj().playlist_pos() as u32)
|
||||
.unwrap()
|
||||
.dynamic_cast()
|
||||
.unwrap();
|
||||
|
||||
Some(song)
|
||||
match self.obj().playlist_pos() {
|
||||
playlist_pos if playlist_pos < 0 => None,
|
||||
playlist_pos => Some(
|
||||
self.obj()
|
||||
.playlist_model()
|
||||
.item(playlist_pos as u32)
|
||||
.unwrap()
|
||||
.dynamic_cast()
|
||||
.unwrap(),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue