Poster downloading update
[cinaest] / src / movie-list-view.vala
index efb1c2e..c1f3bcd 100644 (file)
@@ -307,23 +307,33 @@ public class MovieListView : PannableArea {
                for (int i = a; i <= b; i++) {
                        var path = new TreePath.from_indices (i);
                        TreeIter iter;
-                       if (store.get_iter (out iter, path)) {
-                               Movie movie;
-                               store.get (iter, MovieListStore.Columns.MOVIE, out movie);
-                               if (movie != null) {
-                                       if (poster_mode_) {
-                                               if (movie.poster == null || movie.poster.small == null) try {
-                                                       poster_factory.queue_thumbnail (movie, Poster.SMALL_WIDTH, Poster.SMALL_HEIGHT, false, receive_poster_small);
-                                               } catch (Error e) {
-                                                       warning ("Failed to queue poster request: %s\n", e.message);
-                                               }
-                                       } else {
-                                               if (movie.poster == null || movie.poster.icon == null) try {
-                                                       poster_factory.queue_thumbnail (movie, Poster.ICON_WIDTH, Poster.ICON_HEIGHT, false, receive_poster_icon);
-                                               } catch (Error e) {
-                                                       warning ("Failed to queue poster request: %s\n", e.message);
-                                               }
-                                       }
+                       if (!store.get_iter (out iter, path))
+                               continue;
+
+                       Movie movie;
+                       store.get (iter, MovieListStore.Columns.MOVIE, out movie);
+                       if (movie == null)
+                               continue;
+
+                       if (poster_mode_) {
+                               if (movie.poster == null || movie.poster.small == null) try {
+                                       poster_factory.queue (movie,
+                                                             Poster.SMALL_WIDTH,
+                                                             Poster.SMALL_HEIGHT,
+                                                             true,
+                                                             receive_poster_small);
+                               } catch (Error e) {
+                                       warning ("Failed to queue poster request: %s\n", e.message);
+                               }
+                       } else {
+                               if (movie.poster == null || movie.poster.icon == null) try {
+                                       poster_factory.queue (movie,
+                                                             Poster.ICON_WIDTH,
+                                                             Poster.ICON_HEIGHT,
+                                                             true,
+                                                             receive_poster_icon);
+                               } catch (Error e) {
+                                       warning ("Failed to queue poster request: %s\n", e.message);
                                }
                        }
                }