File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
src/main/kotlin/com/papsign/ktor/openapigen/validation Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -235,10 +235,10 @@ class ValidationHandler private constructor(
235235 transformFun = { t: Any? ->
236236 if (t != null ) {
237237 val copy = t.javaClass.kotlin.memberFunctions.find { it.name == " copy" }
238- val copyParams = copy?.instanceParameter?.let { mutableMapOf<KParameter , Any ?>(it to t) } ? : mutableMapOf ()
238+ val copyParams = copy?.instanceParameter?.let { mutableMapOf<KParameter , Any ?>(it to t) }
239239 handled.forEach { (handler, field) ->
240240 val getter = field.kotlinProperty?.javaGetter
241- if (copy != null && getter != null ) {
241+ if (copy != null && copyParams != null && getter != null ) {
242242 val param = copy.parameters.first { it.name == field.name }
243243 copyParams[param] = handler.handle(getter(t))
244244 } else {
@@ -249,7 +249,9 @@ class ValidationHandler private constructor(
249249 field.isAccessible = accessible
250250 }
251251 }
252- copy?.callBy(copyParams.toMap()) ? : t
252+ if (copy != null && copyParams != null ) {
253+ copy.callBy(copyParams)
254+ } else t
253255 } else t
254256 }
255257 }
You can’t perform that action at this time.
0 commit comments