From d1100efa280c4dfab96d6eb2288de102f3bd2878 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Tue, 24 Jun 2014 18:58:26 +0200 Subject: [PATCH] Fix ragged lines support for fixed files, fixing #90. It's possible for the data to stop before the end of a specified column, in which case we still want to accept whatever shortened data we have. --- src/sources/fixed.lisp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sources/fixed.lisp b/src/sources/fixed.lisp index d623458..1d4c1d5 100644 --- a/src/sources/fixed.lisp +++ b/src/sources/fixed.lisp @@ -38,8 +38,8 @@ :for opts :in fixed-cols-specs :collect (destructuring-bind (&key start length &allow-other-keys) opts (let ((end (+ start length))) - (when (<= end len) - (subseq line start end)))))) + (when (<= start len) + (subseq line start (min len end))))))) (defmethod map-rows ((fixed copy-fixed) &key process-row-fn) "Load data from a text file in Fixed Columns format.