← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~ahayzen/music-app/fix-console-errors-parent-changed-helpers into lp:music-app

 

Andrew Hayzen has proposed merging lp:~ahayzen/music-app/fix-console-errors-parent-changed-helpers into lp:music-app.

Commit message:
* Fix for console errors when the parent change helpers are called

Requested reviews:
  Music App Developers (music-app-dev)

For more details, see:
https://code.launchpad.net/~ahayzen/music-app/fix-console-errors-parent-changed-helpers/+merge/265920

* Fix for console errors when the parent change helpers are called

TESTING:
At step 5 below there is now no console error and I've fixed other potential places this could occur

1) Start the app
2) Goto albums
3) Select an album
4) Select play all
5) Notice in the console an error like the following
file:///home/andy/Workspace/ubuntu/music-app/app/ui/SongsView.qml:91: TypeError: Cannot read property 'title' of undefined
-- 
Your team Music App Developers is requested to review the proposed merge of lp:~ahayzen/music-app/fix-console-errors-parent-changed-helpers into lp:music-app.
=== modified file 'app/ui/SongsView.qml'
--- app/ui/SongsView.qml	2015-07-24 02:09:59 +0000
+++ app/ui/SongsView.qml	2015-07-26 22:45:28 +0000
@@ -54,7 +54,7 @@
     property bool loaded: false  // used to detect difference between first and further loads
 
     onVisibleChanged: {
-        if (page !== undefined && page.childrenChanged) {
+        if (page && page.childrenChanged) {
             page.childrenChanged = false
             refreshWaitTimer.start()
         }
@@ -68,7 +68,7 @@
                 if (songStackPage.visible) {
                     albumTracksModel.filterPlaylistTracks(line2)
                     covers = Playlists.getPlaylistCovers(line2)
-                } else {
+                } else if (songStackPage.page) {
                     songStackPage.page.childrenChanged = true;
                 }
             }
@@ -88,10 +88,8 @@
     function recentChangedHelper()
     {
         // if parent Recent then set changed otherwise refilter
-        if (songStackPage.page.title === i18n.tr("Recent")) {
-            if (songStackPage.page !== undefined) {
-                songStackPage.page.changed = true
-            }
+        if (songStackPage.page && songStackPage.page.title === i18n.tr("Recent")) {
+            songStackPage.page.changed = true
         } else {
             recentModel.filterRecent()
         }
@@ -102,10 +100,8 @@
         force = force === undefined ? false : force  // default force to false
 
         // if parent Playlists then set changed otherwise refilter
-        if (songStackPage.page.title === i18n.tr("Playlists")) {
-            if (songStackPage.page !== undefined) {
-                songStackPage.page.changed = true
-            }
+        if (songStackPage.page && songStackPage.page.title === i18n.tr("Playlists")) {
+            songStackPage.page.changed = true
         } else {
             playlistModel.filterPlaylists()
         }

=== modified file 'debian/changelog'
--- debian/changelog	2015-07-25 04:42:52 +0000
+++ debian/changelog	2015-07-26 22:45:28 +0000
@@ -4,6 +4,9 @@
   * Fix SongsView album art for albums and genres (LP: #1477366)
   * Fix to allow the LibraryEmptyState to work again (LP: #1478162)
 
+  [ Andrew Hayzen ]
+  * Fix for console errors when using the parent changed helpers
+
  -- Victor Thompson <victor.thompson@xxxxxxxxx>  Thu, 23 Jul 2015 21:08:38 -0500
 
 music-app (2.2) vivid; urgency=medium


Follow ups