From a05820f4ad84928a56ce07ae44fbe4e91ad2e2ea Mon Sep 17 00:00:00 2001 From: Dominik Scheiber Date: Fri, 17 Jul 2020 10:19:13 +0200 Subject: [PATCH 1/3] Fix NPE in Backpack Loading --- .../catrobat/catroid/io/BackpackSerializer.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/catroid/src/main/java/org/catrobat/catroid/io/BackpackSerializer.java b/catroid/src/main/java/org/catrobat/catroid/io/BackpackSerializer.java index ffedbe8316b..3bab8f26a6f 100644 --- a/catroid/src/main/java/org/catrobat/catroid/io/BackpackSerializer.java +++ b/catroid/src/main/java/org/catrobat/catroid/io/BackpackSerializer.java @@ -27,8 +27,6 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import com.google.gson.JsonIOException; -import com.google.gson.JsonSyntaxException; import org.catrobat.catroid.common.Backpack; import org.catrobat.catroid.content.Script; @@ -89,13 +87,11 @@ public Backpack loadBackpack() { try { BufferedReader bufferedReader = new BufferedReader(new FileReader(backpackFile)); return backpackGson.fromJson(bufferedReader, Backpack.class); - } catch (FileNotFoundException e) { - Log.e(TAG, "FileNotFoundException: Could not create buffered Writer with file: " - + backpackFile.getAbsolutePath()); - return new Backpack(); - } catch (JsonSyntaxException | JsonIOException jsonException) { - Log.e(TAG, "Cannot load Backpack. Creating new Backpack File.", jsonException); - backpackFile.delete(); + } catch (Exception e) { + if (!(e instanceof FileNotFoundException)) { + backpackFile.delete(); + } + Log.e(TAG, "Cannot load Backpack. Creating new Backpack File.", e); return new Backpack(); } } From 1213d3a116ffdc5913a939ae58ee61080e284e89 Mon Sep 17 00:00:00 2001 From: Dominik Scheiber Date: Fri, 17 Jul 2020 10:26:50 +0200 Subject: [PATCH 2/3] Fix NPE in Upload Projects --- .../recyclerview/fragment/MainMenuFragment.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/catroid/src/main/java/org/catrobat/catroid/ui/recyclerview/fragment/MainMenuFragment.java b/catroid/src/main/java/org/catrobat/catroid/ui/recyclerview/fragment/MainMenuFragment.java index b1f3df34852..9c8861571a1 100644 --- a/catroid/src/main/java/org/catrobat/catroid/ui/recyclerview/fragment/MainMenuFragment.java +++ b/catroid/src/main/java/org/catrobat/catroid/ui/recyclerview/fragment/MainMenuFragment.java @@ -134,14 +134,7 @@ public void onClick(View v) { parent.findViewById(R.id.current_project).setOnClickListener(listener); parent.findViewById(R.id.floating_action_button).setOnClickListener(listener); - updateMyProjects(); - if (myProjects.size() != 0) { - currentProject = myProjects.get(0).getName(); - } else { - currentProject = Utils.getCurrentProjectName(getContext()); - } - loadProjectImage(); - + setAndLoadCurrentProject(); setShowProgressBar(false); } @@ -169,12 +162,19 @@ public void onResume() { getActivity().getIntent().removeExtra(EXTRA_PROJECT_NAME); loadDownloadedProject(projectName); } + setAndLoadCurrentProject(); + } + + private void setAndLoadCurrentProject() { updateMyProjects(); if (myProjects.size() != 0) { currentProject = myProjects.get(0).getName(); } else { currentProject = Utils.getCurrentProjectName(getContext()); } + File projectDir = new File(DEFAULT_ROOT_DIRECTORY, + FileMetaDataExtractor.encodeSpecialCharsForFileSystem(currentProject)); + ProjectLoadTask.task(projectDir, getContext()); loadProjectImage(); } From d86f4ffc2786c4c5d4a50bd996bebe210c8df45a Mon Sep 17 00:00:00 2001 From: Dominik Scheiber Date: Fri, 17 Jul 2020 10:42:12 +0200 Subject: [PATCH 3/3] [HOTFIX] Increase version code and number --- catroid/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/catroid/build.gradle b/catroid/build.gradle index 2a73239dbd0..b3977fb9233 100644 --- a/catroid/build.gradle +++ b/catroid/build.gradle @@ -138,8 +138,8 @@ android { targetSdkVersion 28 applicationId appId testInstrumentationRunner 'org.catrobat.catroid.runner.UiTestApplicationRunner' - versionCode 75 - versionName "0.9.71" + versionCode 78 + versionName "0.9.73" println "VersionCode is $versionCode" println "VersionName is $versionName" multiDexEnabled true