Don't crash when parsing empty string as date. Fixes #344466.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14354 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Chris Shoemaker 2006-06-13 00:35:47 +00:00
parent a36cbde106
commit 9b7245002d

View File

@ -429,25 +429,26 @@
(numeric-date-parts '()) (numeric-date-parts '())
(retval date-string) (retval date-string)
(match (regexp-exec qif-date-compiled-rexp date-string))) (match (regexp-exec qif-date-compiled-rexp date-string)))
(if (match:substring match 1) (if match
(set! date-parts (list (match:substring match 1) (if (match:substring match 1)
(match:substring match 2) (set! date-parts (list (match:substring match 1)
(match:substring match 3))) (match:substring match 2)
;; This is of the form XXXXXXXX; split the string based on (match:substring match 3)))
;; whether the format is YYYYxxxx or xxxxYYYY ;; This is of the form XXXXXXXX; split the string based on
(let ((date-str (match:substring match 4))) ;; whether the format is YYYYxxxx or xxxxYYYY
(case format (let ((date-str (match:substring match 4)))
((d-m-y m-d-y) (case format
(let ((m (regexp-exec qif-date-mdy-compiled-rexp date-str))) ((d-m-y m-d-y)
(set! date-parts (list (match:substring m 1) (let ((m (regexp-exec qif-date-mdy-compiled-rexp date-str)))
(match:substring m 2) (set! date-parts (list (match:substring m 1)
(match:substring m 3))))) (match:substring m 2)
((y-m-d y-d-m) (match:substring m 3)))))
(let ((m (regexp-exec qif-date-ymd-compiled-rexp date-str))) ((y-m-d y-d-m)
(set! date-parts (list (match:substring m 1) (let ((m (regexp-exec qif-date-ymd-compiled-rexp date-str)))
(match:substring m 2) (set! date-parts (list (match:substring m 1)
(match:substring m 3))))) (match:substring m 2)
))) (match:substring m 3)))))
))))
;; get the strings into numbers (but keep the strings around) ;; get the strings into numbers (but keep the strings around)
(set! numeric-date-parts (set! numeric-date-parts