share dialog crash fixed

This commit is contained in:
Bnyro 2022-06-14 14:40:16 +02:00
parent 3260bd6b7a
commit a8f90405a9
2 changed files with 5 additions and 3 deletions

View File

@ -207,7 +207,7 @@ class MainActivity : AppCompatActivity() {
val bundle = Bundle()
bundle.putString("videoId", watch)
// for time stamped links
if (data.query?.contains("t=")!!) {
if (data.query != null && data.query?.contains("t=")!!) {
val timeStamp = data.query.toString().split("t=")[1]
bundle.putLong("timeStamp", timeStamp.toLong())
}
@ -227,7 +227,7 @@ class MainActivity : AppCompatActivity() {
var bundle = Bundle()
bundle.putString("videoId", watch.replace("v=", ""))
// for time stamped links
if (data.query?.contains("t=")!!) {
if (data.query != null && data.query?.contains("t=")!!) {
val timeStamp = data.query.toString().split("t=")[1]
bundle.putLong("timeStamp", timeStamp.toLong())
}
@ -237,7 +237,7 @@ class MainActivity : AppCompatActivity() {
var bundle = Bundle()
bundle.putString("videoId", watch)
// for time stamped links
if (data.query?.contains("t=")!!) {
if (data.query != null && data.query?.contains("t=")!!) {
val timeStamp = data.query.toString().split("t=")[1]
bundle.putLong("timeStamp", timeStamp.toLong())
}

View File

@ -36,6 +36,7 @@ class DescriptionAdapter(
lateinit var bitmap: Bitmap
val thread = Thread {
try {
// try to parse the thumbnailUrl to a Bitmap
val inputStream = URL(thumbnailUrl).openStream()
bitmap = BitmapFactory.decodeStream(inputStream)
} catch (ex: java.lang.Exception) {
@ -44,6 +45,7 @@ class DescriptionAdapter(
}
thread.start()
thread.join()
// return bitmap if initialized
return try {
bitmap
} catch (e: Exception) {