From 9de70ebf672b450c1e7d91adc0bdb96f6dc2c4de Mon Sep 17 00:00:00 2001
From: Florian Jung <flo@windfisch.org>
Date: Wed, 11 May 2011 13:28:42 +0000
Subject: fixed endless-loop-bug by limiting note.pitch to 0..127 (i.e., valid
 ranges)

---
 muse2/muse/midiedit/scoreedit.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp
index a75c5b5b..65559efb 100644
--- a/muse2/muse/midiedit/scoreedit.cpp
+++ b/muse2/muse/midiedit/scoreedit.cpp
@@ -3513,7 +3513,10 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event)
 			case PITCH:
 				if (debugMsg) cout << "changing pitch, delta="<<nearbyint((float)dy/PITCH_DELTA)<<endl;
 				new_pitch=dragged_event_original_pitch - nearbyint((float)dy/PITCH_DELTA);
-
+				
+				if (new_pitch < 0) new_pitch=0;
+				if (new_pitch > 127) new_pitch=127;
+				
 				if (dragged_event.pitch()!=new_pitch)
 				{
 					if (!undo_started)
@@ -4056,7 +4059,6 @@ void staff_t::apply_lasso(QRect rect, set<Event*>& already_processed)
 
 
 /* BUGS and potential bugs
- *   o notes must not be moved to pitches <0 or >127
  *   o when the keymap is not used, this will probably lead to a bug
  *     same when mastertrack is disabled
  *   o tied notes don't work properly when there's a key-change in
-- 
cgit v1.2.3