* wiki still needs some tuning
authorArt Cancro <ajc@citadel.org>
Fri, 16 Oct 2009 03:52:08 +0000 (03:52 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 16 Oct 2009 03:52:08 +0000 (03:52 +0000)
citadel/modules/wiki/serv_wiki.c

index d9db654efbb890b1de7f66299872d9e46e186da5..397b4095c8734b5042e264b03a85f30014f7f8e0 100644 (file)
@@ -117,18 +117,15 @@ int wiki_upload_beforesave(struct CtdlMessage *msg) {
 
        old_msg = CtdlFetchMessage(old_msgnum, 1);
 
-       if (old_msg != NULL) {
-
-               if (old_msg->cm_fields['M'] == NULL) {          /* old version is corrupt? */
-                       CtdlFreeMessage(old_msg);
-                       return(0);
-               }
+       if ((old_msg != NULL) && (old_msg->cm_fields['M'] == NULL)) {   /* old version is corrupt? */
+               CtdlFreeMessage(old_msg);
+               old_msg = NULL;
+       }
        
-               /* If no changes were made, don't bother saving it again */
-               if (!strcmp(msg->cm_fields['M'], old_msg->cm_fields['M'])) {
-                       CtdlFreeMessage(old_msg);
-                       return(1);
-               }
+       /* If no changes were made, don't bother saving it again */
+       if ((old_msg != NULL) && (!strcmp(msg->cm_fields['M'], old_msg->cm_fields['M']))) {
+               CtdlFreeMessage(old_msg);
+               return(1);
        }
 
        /*