r7427 - dumbhippo/trunk/server/src/com/dumbhippo/server/dm



Author: otaylor
Date: 2008-04-16 17:14:37 -0500 (Wed, 16 Apr 2008)
New Revision: 7427

Modified:
   dumbhippo/trunk/server/src/com/dumbhippo/server/dm/NetflixMovieBlockDMO.java
Log:
fix a backtrace when we can't talk to netflix at all

Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/dm/NetflixMovieBlockDMO.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/dm/NetflixMovieBlockDMO.java	2008-04-16 22:14:14 UTC (rev 7426)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/dm/NetflixMovieBlockDMO.java	2008-04-16 22:14:37 UTC (rev 7427)
@@ -9,6 +9,7 @@
 import com.dumbhippo.persistence.User;
 import com.dumbhippo.server.blocks.NetflixBlockView;
 import com.dumbhippo.services.NetflixMovieView;
+import com.dumbhippo.services.NetflixMoviesView;
 
 @DMO(classId="http://mugshot.org/p/o/netflixMovieBlock";)
 public abstract class NetflixMovieBlockDMO extends BlockDMO {
@@ -23,11 +24,15 @@
 	
 	@DMProperty(defaultInclude=true, defaultChildren="+")
 	public List<NetflixMovieDMO> getQueuedMovies() {
-		User user = ((NetflixBlockView)blockView).getPersonSource().getUser();
+		NetflixBlockView netflixBlockView = (NetflixBlockView)blockView;
+		User user = netflixBlockView.getPersonSource().getUser();
 		List<NetflixMovieDMO> result = new ArrayList<NetflixMovieDMO>();
 		
-		for (NetflixMovieView movie : ((NetflixBlockView)blockView).getQueuedMovies().getMovies()) {
-			result.add(session.findUnchecked(NetflixMovieDMO.class, NetflixMovieDMO.getKey(user, movie)));
+		NetflixMoviesView queuedMovies = netflixBlockView.getQueuedMovies();
+		if (queuedMovies != null) {
+			for (NetflixMovieView movie : queuedMovies.getMovies()) {
+				result.add(session.findUnchecked(NetflixMovieDMO.class, NetflixMovieDMO.getKey(user, movie)));
+			}
 		}
 		
 		return result;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]