diff --git a/src/main/java/fi/aalto/cs/apluscourses/intellij/services/PluginSettings.java b/src/main/java/fi/aalto/cs/apluscourses/intellij/services/PluginSettings.java index 164cbcd17..10a871ce4 100644 --- a/src/main/java/fi/aalto/cs/apluscourses/intellij/services/PluginSettings.java +++ b/src/main/java/fi/aalto/cs/apluscourses/intellij/services/PluginSettings.java @@ -205,6 +205,8 @@ public void registerCourseProject(@NotNull CourseProject courseProject) { // instructed to turn the project into a course project for an example when the token is // missing. mainViewModel.toolWindowCardViewModel.setAPlusProject(true); + mainViewModel.toolWindowCardViewModel.setModuleButtonRequiresLogin( + courseProject.getCourse().requiresLoginForModules()); courseProject.user.addValueObserver(mainViewModel, MainViewModel::userChanged); courseProject.user.addSimpleObserver(courseProject, courseP -> courseP.getCourseUpdater().restart()); var exercisesViewModel = new ExercisesTreeViewModel(new ExercisesTree(), new Options()); diff --git a/src/main/java/fi/aalto/cs/apluscourses/model/SubmissionInfo.java b/src/main/java/fi/aalto/cs/apluscourses/model/SubmissionInfo.java index da8186c3d..a8e48886e 100644 --- a/src/main/java/fi/aalto/cs/apluscourses/model/SubmissionInfo.java +++ b/src/main/java/fi/aalto/cs/apluscourses/model/SubmissionInfo.java @@ -35,7 +35,13 @@ public static SubmissionInfo fromJsonObject(@NotNull JSONObject jsonObject) { return new SubmissionInfo(Collections.emptyMap()); } - JSONArray formSpec = exerciseInfo.getJSONArray("form_spec"); + JSONArray formSpec = exerciseInfo.optJSONArray("form_spec"); + if (formSpec == null) { + // Some assignments, such as https://plus.cs.aalto.fi/api/v2/exercises/50181/ don't have the + // form_spec field despite having exercise_info. + return new SubmissionInfo(Collections.emptyMap()); + } + JSONObject localizationInfo = exerciseInfo.getJSONObject("form_i18n"); Map> files = new HashMap<>();