From e290a0a240af782ee91dcd32911261b41eb33d34 Mon Sep 17 00:00:00 2001 From: A117870935 Date: Thu, 13 Jul 2023 18:42:02 +0530 Subject: [PATCH] Fix shared and fav section crash by avoiding multiple api calls. --- .../owncloud/android/ui/fragment/OCFileListFragment.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java index a9e1561987..f588bdb07b 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -6,9 +6,11 @@ * @author David A. Velasco * @author Andy Scherzinger * @author Chris Narkiewicz + * @author TSI-mc * Copyright (C) 2011 Bartek Przybylski * Copyright (C) 2016 ownCloud Inc. * Copyright (C) 2018 Andy Scherzinger + * Copyright (C) 2023 TSI-mc * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, @@ -1657,6 +1659,12 @@ public class OCFileListFragment extends ExtendedListFragment implements return; } + // avoid calling api multiple times if async task is already executing + if (remoteOperationAsyncTask != null && remoteOperationAsyncTask.getStatus() != AsyncTask.Status.FINISHED) { + Log_OC.d(TAG, "OCFileListSearchAsyncTask already running skipping new api call for search event: " + searchEvent.getSearchType()); + return; + } + prepareCurrentSearch(event); searchFragment = true; setEmptyListLoadingMessage();