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> {
|
fn song(&self) -> Option<Song> {
|
||||||
if self.obj().playlist_pos() < 0 {
|
match self.obj().playlist_pos() {
|
||||||
None
|
playlist_pos if playlist_pos < 0 => None,
|
||||||
} else {
|
playlist_pos => Some(
|
||||||
let song: Song = self
|
self.obj()
|
||||||
.obj()
|
|
||||||
.playlist_model()
|
.playlist_model()
|
||||||
.item(self.obj().playlist_pos() as u32)
|
.item(playlist_pos as u32)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.dynamic_cast()
|
.dynamic_cast()
|
||||||
.unwrap();
|
.unwrap(),
|
||||||
|
),
|
||||||
Some(song)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue