diff --git a/openlp/plugins/remotes/html/openlp.js b/openlp/plugins/remotes/html/openlp.js
index a5be8b25c..128c78cb6 100644
--- a/openlp/plugins/remotes/html/openlp.js
+++ b/openlp/plugins/remotes/html/openlp.js
@@ -272,7 +272,7 @@ window.OpenLP = {
value[0] = OpenLP.escapeString(value[0])
}
var txt = "";
- if (value[2].length > 0) {
+ if (value.length > 2) {
txt = value[1] + " ( " + value[2] + " )";
} else {
txt = value[1];
diff --git a/tests/functional/openlp_plugins/songs/test_mediaitem.py b/tests/functional/openlp_plugins/songs/test_mediaitem.py
index a19f7d704..bc6e56af5 100644
--- a/tests/functional/openlp_plugins/songs/test_mediaitem.py
+++ b/tests/functional/openlp_plugins/songs/test_mediaitem.py
@@ -257,3 +257,22 @@ class TestMediaItem(TestCase, TestMixin):
# THEN: They should not match
self.assertFalse(result, "Authors should not match")
+
+ def build_remote_search_test(self):
+ """
+ Test results for the remote search api
+ """
+ # GIVEN: A Song and a search a JSON array should be returned.
+ mock_song = MagicMock()
+ mock_song.id = 123
+ mock_song.title = 'My Song'
+ mock_song.search_title = 'My Song'
+ mock_song.alternate_title = 'My alternative'
+ self.media_item.search_entire = MagicMock()
+ self.media_item.search_entire.return_value = [mock_song]
+
+ # WHEN: I process a search
+ search_results = self.media_item.search('My Song', False)
+
+ # THEN: The correct formatted results are returned
+ self.assertEqual(search_results, [[123, 'My Song', 'My alternative']])