Hi all, I'd like to fix this function implementation, as it makes my eyes cry ;)
Notice that if pFrame == NULL, the function will crash anyway because it's only checked in the first if block and later is dereferenced. static void ImplHandleInputLangChange( HWND hWnd, WPARAM, LPARAM lParam ) { ImplSalYieldMutexAcquireWithWait(); // Feststellen, ob wir IME unterstuetzen WinSalFrame* pFrame = GetWindowPtr( hWnd ); if ( pFrame && pFrame->mbIME && pFrame->mhDefIMEContext ) { HKL hKL = (HKL)lParam; UINT nImeProps = ImmGetProperty( hKL, IGP_PROPERTY ); pFrame->mbSpezIME = (nImeProps & IME_PROP_SPECIAL_UI) != 0; pFrame->mbAtCursorIME = (nImeProps & IME_PROP_AT_CARET) != 0; pFrame->mbHandleIME = !pFrame->mbSpezIME; } // trigger input language and codepage update UINT nLang = pFrame->mnInputLang; ImplUpdateInputLang( pFrame ); // notify change if( nLang != pFrame->mnInputLang ) pFrame->CallCallback( SALEVENT_INPUTLANGUAGECHANGE, 0 ); ImplSalYieldMutexRelease(); } What's the preferred way to fix it? a) put everything in an if (pFrame) {....} block b) if(!pFrame) return; Thanks for the help! :) -- Jesús Corrius <je...@softcatala.org> Document Foundation founding member Mobile: +34 661 11 38 26 Skype: jcorrius | Twitter: @jcorrius _______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice