Commits

Michael Granger committed b445ec1

Guard against empty search terms when assigning the window location.

Comments (0)

Files changed (1)

assets/js/fivefish.js

 
 function updateSearchInput( itemstr ) {
 	var item = this.$menu.find('.active .search-item').data( 'searchitem' );
+	console.debug( "Updating search element for item %s", itemstr );
 	$('#navbar-search-target').val( item.link );
 	return item.name;
 }
 		sorter: sortIndexItems,
 		updater: updateSearchInput,
 		highlighter: highlightMatchingItem
-	}).change( function() {
+	}).change( function(e) {
 		var prefix = $('link[rel=prefix]').attr('href');
 		var rel_link = $('#navbar-search-target').val();
 
-		window.location.assign( prefix + '/' + rel_link );
+		if ( rel_link != '' ) {
+			window.location.assign( prefix + '/' + rel_link );
+		} else {
+			console.error( "Couldn't find selected element for change event %o.", e );
+		}
 	});
 }