mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Merge pull request #180 from misaochan/cursor-close
Fix NPE from cursor close
This commit is contained in:
commit
07e8245fdb
1 changed files with 5 additions and 2 deletions
|
|
@ -13,6 +13,7 @@ import android.os.IBinder;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
import android.webkit.MimeTypeMap;
|
import android.webkit.MimeTypeMap;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
@ -119,7 +120,9 @@ public class UploadController {
|
||||||
contribution.setDataLength(length);
|
contribution.setDataLength(length);
|
||||||
}
|
}
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
throw new RuntimeException(e);
|
Log.e("UploadController", "IO Exception: ", e);
|
||||||
|
} catch(NullPointerException e) {
|
||||||
|
Log.e("UploadController", "Null Pointer Exception: ", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
String mimeType = (String)contribution.getTag("mimeType");
|
String mimeType = (String)contribution.getTag("mimeType");
|
||||||
|
|
@ -142,10 +145,10 @@ public class UploadController {
|
||||||
dateCreated = new Date();
|
dateCreated = new Date();
|
||||||
}
|
}
|
||||||
contribution.setDateCreated(dateCreated);
|
contribution.setDateCreated(dateCreated);
|
||||||
|
cursor.close();
|
||||||
} else {
|
} else {
|
||||||
contribution.setDateCreated(new Date());
|
contribution.setDateCreated(new Date());
|
||||||
}
|
}
|
||||||
cursor.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return contribution;
|
return contribution;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue