← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~ahayzen/music-app/capture-errors-for-currentMeta into lp:music-app

 

Andrew Hayzen has proposed merging lp:~ahayzen/music-app/capture-errors-for-currentMeta into lp:music-app.

Commit message:
* Safeguard against all errors when reading the ms2 lookup and setting into our currentMeta*

Requested reviews:
  Music App Developers (music-app-dev)
Related bugs:
  Bug #1460916 in Ubuntu Music App: "[music] Could not find media. Possible unicode issue."
  https://bugs.launchpad.net/music-app/+bug/1460916

For more details, see:
https://code.launchpad.net/~ahayzen/music-app/capture-errors-for-currentMeta/+merge/261012

* Safeguard against all errors when reading the ms2 lookup and setting into our currentMeta*

If any of the obj.{album,artist,title etc} are undefined it can throw an error and result in the rest not being set, this instead puts an empty string for the value.
-- 
Your team Music App Developers is requested to review the proposed merge of lp:~ahayzen/music-app/capture-errors-for-currentMeta into lp:music-app.
=== modified file 'app/components/Player.qml'
--- app/components/Player.qml	2015-04-29 01:12:57 +0000
+++ app/components/Player.qml	2015-06-03 18:52:34 +0000
@@ -209,15 +209,17 @@
                             obj = musicStore.lookup(source.toString())
                         }
 
-                        player.currentMetaAlbum = obj.album;
-
-                        if (obj.art !== undefined) {  // FIXME: protect against no art property in playlists
-                            player.currentMetaArt = obj.art;
+                        // protect against null reponse from the lookup
+                        if (obj !== null) {
+                            // protect against undefined properties
+                            player.currentMetaAlbum = obj.album || "";
+                            player.currentMetaArt = obj.art || "";  // note playlists don't have art property
+                            player.currentMetaArtist = obj.author || "";
+                            player.currentMetaFile = obj.filename || "";
+                            player.currentMetaTitle = obj.title || "";
+                        } else {
+                            console.debug("Mediascanner lookup resulted in null object", source.toString())
                         }
-
-                        player.currentMetaArtist = obj.author;
-                        player.currentMetaFile = obj.filename;
-                        player.currentMetaTitle = obj.title;
                     }
 
                     console.log("Source: " + source.toString())


Follow ups