diff --git a/scripts.js b/scripts.js index 9e42ef7..fb07423 100644 --- a/scripts.js +++ b/scripts.js @@ -32,9 +32,14 @@ function generateLink() { if (selectedCourseFromPicker === '-1') { let providedRaPlaLink = $('#raplalink').val().toString(); - const url = new URL(providedRaPlaLink); - raplaUser = url.searchParams.get('user'); - raplaFile = url.searchParams.get('file'); + if(providedRaPlaLink !== '') { + const url = new URL(providedRaPlaLink); + raplaUser = url.searchParams.get('user'); + raplaFile = url.searchParams.get('file'); + } else { + $('#full-link').text('Please provide either a course or a RaPla Link!'); + return; + } } else { let courseInfo = courseLinks[selectedCourseFromPicker]; raplaUser = courseInfo.user;