From 00da55045a02434fe9f5696def00fbaa4eae4aef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 22 Sep 2016 09:27:28 +0200 Subject: [PATCH] Be more defensive in parameter checking. --- attract/static/js/tasks.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/attract/static/js/tasks.js b/attract/static/js/tasks.js index 599959b..43c912f 100644 --- a/attract/static/js/tasks.js +++ b/attract/static/js/tasks.js @@ -2,11 +2,10 @@ * Shows a task in the #task-details div. */ function task_open(task_id, project_url) { - if (task_id === undefined) { - if (console) console.log("task_open(undefined) called."); + if (task_id === undefined || project_url === undefined) { + if (console) console.log("task_open(", task_id, project_url, ") called."); return; } - console.log('before anything'); $('#task-list').find('a').removeClass('active'); $('#task-' + task_id).addClass('active'); @@ -29,9 +28,13 @@ function task_open(task_id, project_url) { * Create a task and show it in the #task-details div. */ function task_create(shot_id, project_url, task_type) { + if (shot_id === undefined || project_url === undefined || task_type === undefined) { + if (console) console.log("task_create(", shot_id, project_url, task_type, ") called."); + return; + } var base_url = '/attract/' + project_url + '/tasks/create'; - if (task_type != undefined) { + if (task_type) { base_url += '/' + task_type; }