--- /usr/src/yagtd-0.2.4/src/yagtd.py	2008-05-22 17:02:36.000000000 -0400
+++ /usr/bin/yagtd	2009-03-14 14:13:29.000000000 -0400
@@ -621,7 +621,7 @@
         # Parse command line
         idx, reference = self._parse_args(id_ref)
 
-        if idx:
+        if idx and reference:
             self.do_append("%d ref:%s" % (idx, reference))
 
     #
@@ -635,7 +635,7 @@
         # Parse command line
         idx, level = self._parse_args(id_level)
 
-        if idx and re.match(DIGIT_MATCH, level):
+        if idx and level and re.match(DIGIT_MATCH, level):
             self.do_modify("%d U:%d" % (idx, int(level)))
 
     def do_importance(self, id_level):
@@ -645,7 +645,7 @@
         # Parse command line
         idx, level = self._parse_args(id_level)
 
-        if idx and re.match(DIGIT_MATCH, level):
+        if idx and level and re.match(DIGIT_MATCH, level):
             self.do_modify("%d I:%d" % (idx, int(level)))
 
     def do_complete(self, id_percent):
@@ -655,7 +655,7 @@
         # Parse command line
         idx, percent = self._parse_args(id_percent)
 
-        if idx and re.match(NUMBER_MATCH, percent):
+        if idx and percent and re.match(NUMBER_MATCH, percent):
             self.do_modify("%d C:%d" % (idx, int(percent)))
 
     def do_time(self, id_time):
@@ -665,7 +665,7 @@
         # Parse command line
         idx, time = self._parse_args(id_time)
 
-        if idx and re.match(TIMEDELTA_MATCH, time):
+        if idx and time and re.match(TIMEDELTA_MATCH, time):
             self.do_modify("%d T:%s" % (idx, time))
 
     def do_recurrence(self, id_rec):
@@ -675,7 +675,7 @@
         # Parse command line
         idx, recurrence = self._parse_args(id_rec)
 
-        if idx and re.match(TIMEDELTA_MATCH, recurrence):
+        if idx and recurrence and re.match(TIMEDELTA_MATCH, recurrence):
             self.do_modify("%d R:%s" % (idx, recurrence))
 
     def do_start(self, id_date):
@@ -685,7 +685,7 @@
         # Parse command line
         idx, date = self._parse_args(id_date)
 
-        if idx and re.match(DATE_MATCH, date):
+        if idx and date and re.match(DATE_MATCH, date):
             self.do_modify("%d S:%s" % (idx, date))
 
     def do_due(self, id_date):
@@ -695,7 +695,7 @@
         # Parse command line
         idx, date = self._parse_args(id_date)
 
-        if idx and re.match(DATE_MATCH, date):
+        if idx and date and re.match(DATE_MATCH, date):
             self.do_modify("%d D:%s" % (idx, date))
 
     def do_end(self, id_date):
@@ -705,7 +705,7 @@
         # Parse command line
         idx, date = self._parse_args(id_date)
 
-        if idx and re.match(DATE_MATCH, date):
+        if idx and date and re.match(DATE_MATCH, date):
             self.do_modify("%d E:%s" % (idx, date))
 
     #
