diff --git a/app/src/main/java/eu/michaelvogt/ar/author/fragments/WebViewFragment.kt b/app/src/main/java/eu/michaelvogt/ar/author/fragments/WebViewFragment.kt index 644eb5e..7e50cc8 100644 --- a/app/src/main/java/eu/michaelvogt/ar/author/fragments/WebViewFragment.kt +++ b/app/src/main/java/eu/michaelvogt/ar/author/fragments/WebViewFragment.kt @@ -56,7 +56,7 @@ class WebViewFragment : AppFragment(), View.OnClickListener { NavigationUI.setupWithNavController(top_toolbar, navController) - val content = WebViewFragmentArgs.fromBundle(arguments).contentUrl + val content = WebViewFragmentArgs.fromBundle(arguments!!).contentUrl when (content) { R.string.about_key -> content_info.loadUrl(getString(R.string.file_prefix) + getString(R.string.about_url)) R.string.location_intro_key -> initLocationIntro() diff --git a/app/src/main/java/eu/michaelvogt/ar/author/utils/ViewConverters.kt b/app/src/main/java/eu/michaelvogt/ar/author/utils/ViewConverters.kt index 53f58f3..a1d3247 100644 --- a/app/src/main/java/eu/michaelvogt/ar/author/utils/ViewConverters.kt +++ b/app/src/main/java/eu/michaelvogt/ar/author/utils/ViewConverters.kt @@ -35,6 +35,7 @@ import eu.michaelvogt.ar.author.R import eu.michaelvogt.ar.author.data.* import eu.michaelvogt.ar.author.data.utils.Converters import eu.michaelvogt.ar.author.fragments.AreaEditCard +import java.io.FileNotFoundException @InverseMethod("floatFromString") fun floatToString(value: Float): String { @@ -78,8 +79,13 @@ fun setImage(view: ImageView, url: String, placeholder: Drawable) { if (url.isEmpty()) { view.setImageDrawable(placeholder) } else if (url.startsWith(ImageUtils.assetPathPrefix)) { - val asset = view.resources.assets.open(url.removePrefix(ImageUtils.assetPathPrefix)) - view.setImageDrawable(Drawable.createFromStream(asset, null)) + try { + val asset = view.resources.assets.open(url.removePrefix(ImageUtils.assetPathPrefix)) + view.setImageDrawable(Drawable.createFromStream(asset, null)) + } catch (e: FileNotFoundException) { + Log.i("ViewConverters", "Image not found", e) + view.setImageResource(R.drawable.touristar_logo) + } } else { val bitmap: Bitmap try {