condition around getting a song
This commit is contained in:
parent
0288513ba0
commit
a8eec1dee6
1 changed files with 8 additions and 5 deletions
|
@ -263,11 +263,14 @@ mod song_model {
|
|||
.execute(db);
|
||||
match result {
|
||||
Ok(_i) => {
|
||||
let song = self.as_mut().songs_mut().get_mut(index as usize).unwrap();
|
||||
if let Some(song) = self.as_mut().songs_mut().get_mut(index as usize) {
|
||||
song.title = updated_title.to_string();
|
||||
self.as_mut()
|
||||
.emit_data_changed(model_index, model_index, &vector_roles);
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
Err(_e) => false,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue