Skip to content

Commit

Permalink
fix crash when sharing
Browse files Browse the repository at this point in the history
  • Loading branch information
SanjaySargam authored and david-allison committed Dec 23, 2023
1 parent 9d8cbf8 commit d5d45cd
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,15 @@ import anki.generic.Empty
import anki.import_export.ExportLimit
import anki.import_export.exportLimit
import com.google.android.material.snackbar.Snackbar
import com.ichi2.anki.*
import com.ichi2.anki.AnkiActivity
import com.ichi2.anki.R
import com.ichi2.anki.UIUtils.showThemedToast
import com.ichi2.anki.dialogs.ExportDialog.ExportDialogListener
import com.ichi2.anki.dialogs.ExportDialogParams
import com.ichi2.anki.dialogs.ExportReadyDialog.ExportReadyDialogListener
import com.ichi2.anki.exportApkg
import com.ichi2.anki.exportColpkg
import com.ichi2.anki.launchCatchingTask
import com.ichi2.anki.preferences.sharedPrefs
import com.ichi2.anki.servicelayer.ScopedStorageService
import com.ichi2.anki.snackbar.showSnackbar
Expand Down Expand Up @@ -289,8 +293,9 @@ class ActivityExportingDelegate(private val activity: AnkiActivity, private val
* the mod of the collection and the time at which it occurred.
* This will allow to check whether a recent export was made, hence scoped storage migration is safe.
*/
@NeedsTest("fix crash when sharing")
private fun saveSuccessfulCollectionExportIfRelevant() {
if (!fileExportPath.endsWith(".colpkg")) return
if (::fileExportPath.isInitialized && !fileExportPath.endsWith(".colpkg")) return
activity.sharedPrefs().edit {
putLong(
LAST_SUCCESSFUL_EXPORT_AT_SECOND_KEY,
Expand Down

0 comments on commit d5d45cd

Please sign in to comment.