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);
|
.execute(db);
|
||||||
match result {
|
match result {
|
||||||
Ok(_i) => {
|
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();
|
song.title = updated_title.to_string();
|
||||||
self.as_mut()
|
self.as_mut()
|
||||||
.emit_data_changed(model_index, model_index, &vector_roles);
|
.emit_data_changed(model_index, model_index, &vector_roles);
|
||||||
true
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Err(_e) => false,
|
Err(_e) => false,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue