From ed966469a4d2ae1c7d5ddad1b9d74e8d4d0783b9 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Fri, 14 Mar 2008 22:34:54 +0100 Subject: [PATCH] wininet: Split out NULL ptr and function ptr check. --- dlls/wininet/internet.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index d5fbbc196eb..be1ee164f1b 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -1704,11 +1704,16 @@ BOOL WINAPI InternetWriteFile(HINTERNET hFile, LPCVOID lpBuffer, TRACE("(%p %p %d %p)\n", hFile, lpBuffer, dwNumOfBytesToWrite, lpdwNumOfBytesWritten); lpwh = WININET_GetObject( hFile ); + if (!lpwh) { + WARN("Invalid handle\n"); + SetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } - if(lpwh && lpwh->vtbl->WriteFile) { + if(lpwh->vtbl->WriteFile) { retval = lpwh->vtbl->WriteFile(lpwh, lpBuffer, dwNumOfBytesToWrite, lpdwNumOfBytesWritten); }else { - WARN("Invalid handle\n"); + WARN("No Writefile method.\n"); SetLastError(ERROR_INVALID_HANDLE); retval = FALSE; } @@ -1848,7 +1853,7 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d TRACE("(%p, 0x%08x, %p, %p)\n", hInternet, dwOption, lpBuffer, lpdwBufferLength); - lpwhh = (LPWININETHANDLEHEADER) WININET_GetObject( hInternet ); + lpwhh = WININET_GetObject( hInternet ); switch (dwOption) {