Be more defensive in parameter checking.

This commit is contained in:
2016-09-22 09:27:28 +02:00
parent c99bb8f41d
commit 00da55045a

View File

@@ -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;
}