diff --git a/src/pyj/book_list/main.pyj b/src/pyj/book_list/main.pyj
index b90394ff92..e7b47ba5d7 100644
--- a/src/pyj/book_list/main.pyj
+++ b/src/pyj/book_list/main.pyj
@@ -33,7 +33,8 @@ def remove_initial_progress_bar():
p.parentNode.removeChild(p)
def onerror(msg, script_url, line_number, column_number, error_object):
- console.log(error_object)
+ if error_object:
+ console.log(error_object)
try:
fname = script_url.rpartition('/')[-1] or script_url
msg = msg + '
' + 'Error at {}:{}:{}'.format(fname, line_number, column_number or '') + ''