summaryrefslogtreecommitdiff
path: root/modules/search/helpers
diff options
context:
space:
mode:
authorNathan Kinkade <nath@nkinka.de>2012-12-10 22:35:46 +0000
committerNathan Kinkade <nath@nkinka.de>2012-12-10 22:35:46 +0000
commitdf12e1bcf7547802a94a7b492cdb22fca9ec6e1c (patch)
treef9a9b747456b534a661c65fc401b506f3dc4ee84 /modules/search/helpers
parentfc7750c742d30c6ebd42a12c9d468f54e90d470d (diff)
parent7c62c67d56e854f69a411dd56c48ef066f951c48 (diff)
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules/search/helpers')
-rw-r--r--modules/search/helpers/search.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/modules/search/helpers/search.php b/modules/search/helpers/search.php
index b7fa21c4..64a13825 100644
--- a/modules/search/helpers/search.php
+++ b/modules/search/helpers/search.php
@@ -117,7 +117,14 @@ class search_Core {
// Truncate the score by two decimal places as this resolves the issues
// that arise due to in exact numeric conversions.
- $score = $db->query($query)->current()->score;
+ $current = $db->query($query)->current();
+ if (!$current) {
+ // We can't find this result in our result set - perhaps we've fallen out of context? Clear
+ // the context and try again.
+ item::clear_display_context_callback();
+ url::redirect(url::current());
+ }
+ $score = $current->score();
if (strlen($score) > 7) {
$score = substr($score, 0, strlen($score) - 2);
}