From 0c1abd5a544026887f5f7a59479d7513b523fd4a Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Wed, 19 Sep 2007 07:40:55 +0000 Subject: [PATCH] 2007-09-19 Benny Malengier * src/GrampsDbUtils/_GedcomStageOne.py: empty gedcom gives error message, not crash svn: r8991 --- ChangeLog | 3 +++ TODO | 2 ++ src/GrampsDbUtils/_GedcomStageOne.py | 3 +++ 3 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index ee71fd56b..646a3e278 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2007-09-19 Benny Malengier + * src/GrampsDbUtils/_GedcomStageOne.py: empty gedcom gives error message, not crash + 2007-09-17 Zsolt Foldvari * src/glade/gramps.glade: Make labels translatable. #0001035 diff --git a/TODO b/TODO index 2d32b491a..93748dffc 100644 --- a/TODO +++ b/TODO @@ -15,6 +15,8 @@ necessarily need multiple notes. Determine which ones should and shouldn't. - DONE +* before release: fix command line options + * before release on multiple notes: --> in note view: only show orphaned notes (notes are NOT in remove orphaned notes tool which is what we want ) diff --git a/src/GrampsDbUtils/_GedcomStageOne.py b/src/GrampsDbUtils/_GedcomStageOne.py index d8ddbaa4c..9dd699e4a 100644 --- a/src/GrampsDbUtils/_GedcomStageOne.py +++ b/src/GrampsDbUtils/_GedcomStageOne.py @@ -58,6 +58,7 @@ LOG = logging.getLogger(".GedcomImport") BAD_UTF16 = _("Your GEDCOM file is corrupted. " "The file appears to be encoded using the UTF16 " "character set, but is missing the BOM marker.") +EMPTY_GED = _("Your GEDCOM file is empty.") #------------------------------------------------------------------------- # @@ -125,6 +126,8 @@ class StageOne: self.enc = "UTF16" input_file.seek(0) return codecs.EncodedFile(input_file, 'utf8', 'utf16') + elif not line : + raise Errors.GedcomError(EMPTY_GED) elif line[0] == "\x00" or line[1] == "\x00": raise Errors.GedcomError(BAD_UTF16) else: