XML parsing aide

Files at this revision

API Documentation at this revision

Comitter:
takashikojo
Date:
Sun Jul 05 08:12:12 2015 +0000
Parent:
1:ad5fd8c29c1f
Commit message:
NULL pointer protection

Changed in this revision

XMLaide.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r ad5fd8c29c1f -r c86701a4f5b0 XMLaide.cpp
--- a/XMLaide.cpp	Sat Jun 27 10:35:34 2015 +0000
+++ b/XMLaide.cpp	Sun Jul 05 08:12:12 2015 +0000
@@ -8,6 +8,7 @@
 #define TAG_SIZE 20
     char tag[TAG_SIZE] = "<" ;
 
+    if(p == NULL)return NULL ;
     find = strstr(p, strcat(tag, name)) ;
     if(find) {
         find = strchr(find, '>') ;
@@ -18,6 +19,7 @@
 const char *XML_getElement(const char *p, char *element, int size)
 {
     const char *find ;
+    if(p == NULL)return NULL ;
     find = strstr(p, "</") ;
 
     if(find) {