]> git.donarmstrong.com Git - lilypond.git/commitdiff
MusicXML: Fixes of my previous commit
authorReinhold Kainhofer <reinhold@kainhofer.com>
Wed, 19 Sep 2007 01:29:56 +0000 (03:29 +0200)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Wed, 3 Oct 2007 16:39:59 +0000 (18:39 +0200)
If a score does not use any <staff> elements, fool musicxml2ly with
a dummy value of "None". Similarly, don't use dict[staff], but dict.get
to avoid crashes in that case.

Signed-off-by: Reinhold Kainhofer <reinhold@kainhofer.com>
python/musicxml.py

index 7281a129f3921a49c95bc860dde67acf8b8ecd6f..e9660eb571ae13ccfd9512fc609bce19149e9a96 100644 (file)
@@ -549,6 +549,8 @@ class Part (Music_xml_node):
             sid = None
             if staff_id:
                 sid = staff_id.get_text ()
+            else:
+                sid = "None"
             if vid and not voices.has_key (vid):
                 voices[vid] = Musicxml_voice()
             if vid and sid and not n.get_maybe_exist_typed_child (Grace):
@@ -592,7 +594,7 @@ class Part (Music_xml_node):
                 if staff_id:
                     staff_id = staff_id.get_text ()
                 if staff_id:
-                    dir_voices = staff_to_voice_dict[staff_id]
+                    dir_voices = staff_to_voice_dict.get (staff_id, voices.keys ())
                 else:
                     dir_voices = voices.keys ()
                 for v in dir_voices: