Commits

Anonymous committed 49c6917

Fixed issue with following strategy getting an empty JSON array for content when not following anyone. (Not sure if it was happening across the board or just the test user)

Comments (0)

Files changed (1)

service/src/com/photobucket/api/service/UserFollowingStrategy.java

 	
 	@Override
 	protected void parseContent(Object contentObject) throws JSONException {
-		JSONObject content = (JSONObject)contentObject;
-		
-		if (content.has("people")) {
-			people = parseSubscriptions(content.getJSONArray("people"));
-		} else {
-			people = Collections.emptyList();
-		}
+	    if (contentObject instanceof JSONObject) {
+    		JSONObject content = (JSONObject)contentObject;
+    		
+    		if (content.has("people")) {
+    			people = parseSubscriptions(content.getJSONArray("people"));
+    		} else {
+    			people = Collections.emptyList();
+    		}
+	    } else if (contentObject instanceof JSONArray) {
+	        logger.warn("Received JSONArray with " + ((JSONArray)contentObject).length() + 
+	                " member(s) for content, don't know how to parse it");
+	        people = Collections.emptyList();
+	    }
 	}
 
 	@Override