add a null check to spinner adapter

This commit is contained in:
tibbi 2017-01-06 23:01:55 +01:00
parent 7114d60c11
commit ab805df2fb

View file

@ -18,6 +18,9 @@ class MyAppCompatSpinner : AppCompatSpinner {
constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(context, attrs, defStyle)
fun setColors(textColor: Int, accentColor: Int, backgroundColor: Int) {
if (adapter == null)
return
val cnt = adapter.count
val items = kotlin.arrayOfNulls<Any>(cnt)
for (i in 0..cnt - 1)