]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- added check
authorArvin Schnell <aschnell@suse.de>
Fri, 16 Sep 2011 09:06:17 +0000 (11:06 +0200)
committerArvin Schnell <aschnell@suse.de>
Fri, 16 Sep 2011 09:06:17 +0000 (11:06 +0200)
snapper/Snapshot.cc

index e42ba77fa5da682cb5726cd03f81bd110fb8e949..a841e4ec6e5c9cdc337cbe762deb0b3c2d83f941 100644 (file)
@@ -142,6 +142,11 @@ namespace snapper
        {
            unsigned int num;
            it->substr(snapper->infosDir().length() + 1) >> num;
+           if (num == 0)
+           {
+               y2err("invalid num 0. not adding snapshot");
+               continue;
+           }
 
            XmlFile file(*it);
            const xmlNode* root = file.getRootElement();
@@ -169,10 +174,10 @@ namespace snapper
                continue;
            }
 
-           getChildValue(node, "description", snapshot.description);
-
            getChildValue(node, "pre_num", snapshot.pre_num);
 
+           getChildValue(node, "description", snapshot.description);
+
            getChildValue(node, "cleanup", snapshot.cleanup);
 
            const list<const xmlNode*> l = getChildNodes(node, "userdata");
@@ -360,12 +365,12 @@ namespace snapper
 
        setChildValue(node, "date", datetime(date, true, true));
 
-       if (!description.empty())
-           setChildValue(node, "description", description);
-
        if (type == POST)
            setChildValue(node, "pre_num", pre_num);
 
+       if (!description.empty())
+           setChildValue(node, "description", description);
+
        if (!cleanup.empty())
            setChildValue(node, "cleanup", cleanup);