diff --git a/app/src/main/java/com/hous/hous_aos/util/SafeLet.kt b/app/src/main/java/com/hous/hous_aos/util/SafeLet.kt new file mode 100644 index 00000000..35569106 --- /dev/null +++ b/app/src/main/java/com/hous/hous_aos/util/SafeLet.kt @@ -0,0 +1,7 @@ +package com.hous.hous_aos.util + +/** + * 변수 2가지 이상 null 체크할 때 사용 */ +inline fun safeLet(p1: T1?, p2: T2?, block: (T1, T2) -> R?): R? { + return if (p1 != null && p2 != null) block(p1, p2) else null +}