Fix some bug:

Avoid dismiss dialog already dismissed
Avoid access to invalid index when have no server
This commit is contained in:
Schoumi 2017-07-11 00:44:03 +02:00
parent 5f0b439e21
commit a6934bccb8

View file

@ -283,7 +283,7 @@ public class UploadActivity extends AppCompatActivity {
runOnUiThread(new Runnable() {
@Override
public void run() {
if(progressDialog != null) {
if(progressDialog != null && progressDialog.isShowing()) {
progressDialog.dismiss();
progressDialog = null;
}
@ -522,7 +522,7 @@ public class UploadActivity extends AppCompatActivity {
//what server we use
Spinner urlSpinner = (Spinner)findViewById(R.id.servers_spinner);
int pos = urlSpinner.getSelectedItemPosition();
if(urls.size() < pos) {
if(urls.size() < pos || pos == Spinner.INVALID_POSITION) {
runOnUiThread(new Runnable() {
@Override
public void run() {