[msitools: 2/3] wixl: Fix VersionMin/VersionMax null handling in Upgrade table




commit a982e4f29a7f42d2ad26dd9adf42a1fda2aa3f46
Author: Hendrik Eckardt <hendrik eckardt gdata-adan de>
Date:   Mon Oct 18 18:08:31 2021 +0200

    wixl: Fix VersionMin/VersionMax null handling in Upgrade table

 tools/wixl/msi.vala | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/tools/wixl/msi.vala b/tools/wixl/msi.vala
index 3e14226..495597e 100644
--- a/tools/wixl/msi.vala
+++ b/tools/wixl/msi.vala
@@ -572,11 +572,14 @@ namespace Wixl {
             sql_insert = "INSERT INTO `Upgrade` (`UpgradeCode`, `VersionMin`, `VersionMax`, `Attributes`, 
`ActionProperty`) VALUES (?, ?, ?, ?, ?)";
         }
 
-        public void add (string UpgradeCode, string VersionMin, string? VersionMax, int Attributes, string 
ActionProperty) throws GLib.Error {
+        public void add (string UpgradeCode, string? VersionMin, string? VersionMax, int Attributes, string 
ActionProperty) throws GLib.Error {
+            if (VersionMin == null && VersionMax == null)
+                throw new Wixl.Error.FAILED ("VersionMin and VersionMax must not both be null");
+
             var rec = new Libmsi.Record (5);
 
             if (!rec.set_string (1, UpgradeCode) ||
-                !rec.set_string (2, VersionMin) ||
+                (VersionMin != null && !rec.set_string (2, VersionMin)) ||
                 (VersionMax != null && !rec.set_string (3, VersionMax)) ||
                 !rec.set_int (4, Attributes) ||
                 !rec.set_string (5, ActionProperty))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]