1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-25 18:15:49 +01:00

Only repaint chart when activity is still alive

(fixes error message when synchronizing in the charts activity and then
switching orientation)
This commit is contained in:
cpfeiffer 2015-08-16 23:27:18 +02:00
parent 0bd65e050c
commit 27a9eb8a07

View File

@ -3,6 +3,7 @@ package nodomain.freeyourgadget.gadgetbridge.activities.charts;
import android.content.Context;
import android.graphics.Color;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import com.github.mikephil.charting.charts.BarLineChartBase;
import com.github.mikephil.charting.charts.Chart;
@ -360,7 +361,12 @@ public abstract class AbstractChartFragment extends Fragment {
@Override
protected void onPostExecute(Object o) {
super.onPostExecute(o);
renderCharts();
FragmentActivity activity = getActivity();
if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) {
renderCharts();
} else {
LOG.info("Not rendering charts because activity is not available anymore");
}
}
}
}