Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1083 from duckduckgo/brian/movies-be-more-graceful
Browse files Browse the repository at this point in the history
More graceful handling of no/empty results from movies spice
  • Loading branch information
russellholt committed Sep 12, 2014
2 parents 273b01b + 2b326e5 commit bd9be41
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions share/spice/movie/movie.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
}

env.ddg_spice_movie = function(api_result) {
if(!api_result) {
if(!api_result || !api_result.movies || !api_result.movies.length) {
return Spice.failed('movie');
}

Expand Down Expand Up @@ -79,7 +79,10 @@

// Make sure we hide the title and ratings.
// It looks nice to show only the poster of the movie.
Spice.getDOM('movie').find('.tile__body').hide();
var $dom = Spice.getDOM('movie')
if ($dom && $dom.length) {
$dom.find('.tile__body').hide();
}
};

// Convert minutes to hr. min. format.
Expand All @@ -93,4 +96,4 @@
}
return hours + (minutes > 0 ? minutes + ' min.' : '');
});
}(this));
}(this));

0 comments on commit bd9be41

Please sign in to comment.