diff --git a/if1632/thunk.c b/if1632/thunk.c
index 20860b434e1c3705bfc598320d6e32bbb9f830e0..48ddfb943892d0a5f384e19a8ba36b7bebf950b6 100644
--- a/if1632/thunk.c
+++ b/if1632/thunk.c
@@ -1380,6 +1380,8 @@ FARPROC WINAPI AllocLSThunkletCallbackEx16( SEGPTR target,
                                             DWORD relay, HTASK16 task )
 {
     THUNKLET *thunk = (THUNKLET *)PTR_SEG_TO_LIN( target );
+    if ( !thunk ) return NULL;
+
     if (   IsSLThunklet16( thunk ) && thunk->relay == relay 
         && thunk->glue == (DWORD)ThunkletCallbackGlueSL )
         return (FARPROC)thunk->target;
@@ -1395,6 +1397,8 @@ SEGPTR WINAPI AllocSLThunkletCallbackEx16( FARPROC target,
                                          DWORD relay, HTASK16 task )
 {
     THUNKLET *thunk = (THUNKLET *)target;
+    if ( !thunk ) return 0;
+
     if (   IsLSThunklet( thunk ) && thunk->relay == relay 
         && thunk->glue == (DWORD)ThunkletCallbackGlueLS - (DWORD)&thunk->type )
         return (SEGPTR)thunk->target;