From: Reinhold Kainhofer <reinhold@kainhofer.com> Date: Wed, 10 Oct 2007 13:00:03 +0000 (+0200) Subject: MusicXML: Add sanity check before setting a duration X-Git-Tag: release/2.11.35-1~88 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=31de3540e46c7b587a79b8684665bffa509367e8;p=lilypond.git MusicXML: Add sanity check before setting a duration --- diff --git a/scripts/musicxml2ly.py b/scripts/musicxml2ly.py index b31511a291..e07584eae2 100644 --- a/scripts/musicxml2ly.py +++ b/scripts/musicxml2ly.py @@ -156,7 +156,14 @@ def rational_to_lily_duration (rational_len): d = musicexp.Duration () d.duration_log = {1: 0, 2: 1, 4:2, 8:3, 16:4, 32:5, 64:6, 128:7, 256:8, 512:9}.get (rational_len.denominator (), -1) d.factor = Rational (rational_len.numerator ()) - return d + if d.duration_log < 0: + error_message ("Encountered rational duration with denominator %s, " + "unable to convert to lilypond duration" % + rational_len.denominator ()) + # TODO: Test the above error message + return None + else: + return d def musicxml_partial_to_lily (partial_len): if partial_len > 0: