]> git.donarmstrong.com Git - lilypond.git/commitdiff
robustness: survive \lyricsto argument without Lyrics context. Fixes #183
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 20 Dec 2006 22:58:09 +0000 (23:58 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 20 Dec 2006 22:58:09 +0000 (23:58 +0100)
lily/lyric-combine-music-iterator.cc

index 6011ede3f24c29f3363d847bd683b2aa3295be6e..85e72d3197961ff2144bc1f2094c84b6295cf8e5 100644 (file)
@@ -79,7 +79,8 @@ Lyric_combine_music_iterator::set_music_context (Context *to)
   if (to)
     {
       to->event_source()->add_listener (GET_LISTENER (set_busy), ly_symbol2scm ("music-event"));
-      lyrics_context_->set_property ("associatedVoiceContext", to->self_scm ());
+      if (lyrics_context_)
+       lyrics_context_->set_property ("associatedVoiceContext", to->self_scm ());
     }
 }
 
@@ -158,6 +159,11 @@ Lyric_combine_music_iterator::construct_children ()
   lyrics_context_ = find_context_below (lyric_iter_->get_outlet (),
                                        ly_symbol2scm ("Lyrics"), "");
 
+  if (!lyrics_context_)
+    {
+      m->origin ()->warning ("argument of \\lyricsto should contain Lyrics context");
+    }
+  
   lyricsto_voice_name_ = get_music ()->get_property ("associated-context");
 
   Context *voice = find_voice ();
@@ -169,7 +175,7 @@ Lyric_combine_music_iterator::construct_children ()
         Wait for a Create_context event. If this isn't done, lyrics can be 
         delayed when voices are created implicitly.
       */
-      Global_context *g = lyrics_context_->get_global_context ();
+      Global_context *g = get_outlet ()->get_global_context ();
       g->events_below ()->add_listener (GET_LISTENER (check_new_context), ly_symbol2scm ("CreateContext"));
     }