Try to fix NPE while animating thread

Conflicts:
	OsmAnd/src/net/osmand/plus/views/AnimateDraggingMapThread.java
This commit is contained in:
Victor Shcherb 2017-05-29 22:25:18 +02:00
parent fa407ef386
commit 82512864c5

View file

@ -90,18 +90,19 @@ public class AnimateDraggingMapThread {
public void stopAnimatingSync(){
// wait until current thread != null
stopped = true;
while(currentThread != null){
Thread tt = null;
while((tt = currentThread) != null){
try {
currentThread.join();
} catch (InterruptedException e) {
tt.join();
} catch (Exception e) {
}
}
}
public void startThreadAnimating(final Runnable runnable){
public synchronized void startThreadAnimating(final Runnable runnable){
stopAnimatingSync();
stopped = false;
currentThread = new Thread(new Runnable() {
final Thread t = new Thread(new Runnable() {
@Override
public void run() {
@ -114,8 +115,8 @@ public class AnimateDraggingMapThread {
}
}
}, "Animating Thread");
currentThread.start();
currentThread = t;
t.start();
}
public void startMoving(final double finalLat, final double finalLon, final Pair<Integer, Double> finalZoom,