Hans Leidekker (@hans) commented about dlls/odbc32/proxyodbc.c:
- ret = env->win32_funcs->SQLError( env->win32_handle, con->win32_handle, stmt->win32_handle, SqlState, - NativeError, MessageText, BufferLength, TextLength ); + const struct win32_funcs *win32_funcs = NULL; + + if (env) win32_funcs = env->win32_funcs; + else if (con) win32_funcs = con->win32_funcs; + else if (stmt) win32_funcs = stmt->win32_funcs; + + if(win32_funcs) + ret = win32_funcs->SQLError( env ? env->win32_handle : NULL, + con ? con->win32_handle : NULL, + stmt ? stmt->win32_handle : NULL, + SqlState, NativeError, MessageText, BufferLength, TextLength ); + else + ERR("No function map found\n"); } The condition for this block ensures that at least one handle is set and we always set win32_funcs when we create a win32 handle. This means that the win32_funcs check is redundant.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/6063#note_76233