This commit is contained in:
ligi 2019-10-30 11:11:22 +09:00
parent ac1426437e
commit aea2f93651
No known key found for this signature in database
GPG key ID: 8E81894010ABF23D
3 changed files with 5 additions and 3 deletions

View file

@ -65,6 +65,8 @@ private fun fromOKHttp(uri: Uri): InputStreamWithSource? {
return null
}
private fun fromContent(ctx: Context, uri: Uri) = InputStreamWithSource(uri.toString(), ctx.contentResolver.openInputStream(uri))
private fun fromContent(ctx: Context, uri: Uri) = ctx.contentResolver.openInputStream(uri)?.let {
InputStreamWithSource(uri.toString(), it)
}
private fun getDefaultInputStreamForUri(uri: Uri) = InputStreamWithSource(uri.toString(), BufferedInputStream(URL(uri.toString()).openStream(), 4096))

View file

@ -33,7 +33,7 @@ class PastLocationsStore constructor(private val sharedPreferences: SharedPrefer
// feature not available for these versions
val locations: Set<String>
get() = sharedPreferences.getStringSet(KEY_PAST_LOCATIONS, emptySet<String>())
get() = sharedPreferences.getStringSet(KEY_PAST_LOCATIONS, emptySet<String>())?: emptySet()
companion object {

View file

@ -31,7 +31,7 @@ class ImageEditHelper(private val context: Activity, private val passStore: Pass
}
private fun extractImage(imageReturnedIntent: Intent, name: String) {
val extractedFile = imageReturnedIntent.data.loadImage(context)
val extractedFile = imageReturnedIntent.data?.loadImage(context)
val pass = passStore.currentPass
if (extractedFile != null && pass != null && extractedFile.exists()) {
try {