Fix clipData may be null bug

Fix length = 0 divide
Fix link_item size
pull/1/head
Schoumi 6 years ago
parent a841d7ae14
commit 9358a47de7
  1. 5
      app/src/main/java/fr/mobdev/goblim/activity/UploadActivity.java
  2. 2
      app/src/main/res/layout/link_item.xml

@ -221,7 +221,8 @@ public class UploadActivity extends AppCompatActivity {
public void run() {
if(progressDialog != null) {
progressDialog.setMessage(getString(R.string.uploading_files)+" "+fileNo+"/"+nbFiles);
progressDialog.setProgress(progress * 100 / length);
if(length != 0)
progressDialog.setProgress(progress * 100 / length);
}
}
});
@ -531,7 +532,7 @@ public class UploadActivity extends AppCompatActivity {
adapter.addUri(this,imageUri);
} else {
ClipData clip = returnIntent.getClipData();
for(int i = 0; i < clip.getItemCount(); i++) {
for(int i = 0; clip != null && i < clip.getItemCount(); i++) {
Uri imageUri = clip.getItemAt(i).getUri();
uris.add(imageUri);
updateSpanCount();

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="200dp"
android:layout_margin="5dp"
>

Loading…
Cancel
Save