Added NULL pointer checks.

diff --git a/memory/codepage.c b/memory/codepage.c
index 0b5b96f..ae86d50 100644
--- a/memory/codepage.c
+++ b/memory/codepage.c
@@ -246,6 +246,12 @@
     const union cptable *table;
     int ret;
 
+    if (!src || (!dst && dstlen))
+    {
+        SetLastError( ERROR_INVALID_PARAMETER );
+        return 0;
+    }
+
     if (srclen == -1) srclen = strlen(src) + 1;
 
     if (page >= CP_UTF7)
@@ -312,6 +318,12 @@
     const union cptable *table;
     int ret, used_tmp;
 
+    if (!src || (!dst && dstlen))
+    {
+        SetLastError( ERROR_INVALID_PARAMETER );
+        return 0;
+    }
+
     if (srclen == -1) srclen = strlenW(src) + 1;
 
     if (page >= CP_UTF7)