comparison android/DWindows.kt @ 2642:3edc64443b71

Android: Fix a null pointer exception in the menu code running HandyFTP on Android. HandyFTP still failing after this fix, but it is due to missing resources in the project. Hopefully when I fix the resources it will start up.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 13 Aug 2021 21:50:47 +0000
parents 22105f99dd6a
children 28ca1e59e76f
comparison
equal deleted inserted replaced
2641:608598b9fed9 2642:3edc64443b71
945 // Handle DW_MIS_ENABLED 945 // Handle DW_MIS_ENABLED
946 if ((state and 1) != 0) { 946 if ((state and 1) != 0) {
947 enabled = true 947 enabled = true
948 } 948 }
949 menuitem.enabled = enabled 949 menuitem.enabled = enabled
950 runOnUiThread { 950 if(menuitem.menuitem != null) {
951 menuitem.menuitem!!.isEnabled = enabled 951 runOnUiThread {
952 invalidateOptionsMenu() 952 menuitem.menuitem!!.isEnabled = enabled
953 invalidateOptionsMenu()
954 }
953 } 955 }
954 } 956 }
955 957
956 // Handle DW_MIS_CHECKED/UNCHECKED 958 // Handle DW_MIS_CHECKED/UNCHECKED
957 if((state and ((1 shl 2) or (1 shl 3))) != 0) { 959 if((state and ((1 shl 2) or (1 shl 3))) != 0) {
960 // Handle DW_MIS_CHECKED 962 // Handle DW_MIS_CHECKED
961 if ((state and (1 shl 2)) != 0) { 963 if ((state and (1 shl 2)) != 0) {
962 checked = true 964 checked = true
963 } 965 }
964 menuitem.checked = checked 966 menuitem.checked = checked
965 runOnUiThread { 967 if(menuitem.menuitem != null) {
966 menuitem.menuitem!!.isChecked = checked 968 runOnUiThread {
967 invalidateOptionsMenu() 969 menuitem.menuitem!!.isChecked = checked
970 invalidateOptionsMenu()
971 }
968 } 972 }
969 } 973 }
970 } 974 }
971 } 975 }
972 } 976 }