Browse Source

Clean up code for TextField

tags/v0.4.0
ben 7 years ago
parent
commit
2515311aad
1 changed files with 3 additions and 5 deletions
  1. +3
    -5
      src/core/MidiInterface.cpp

+ 3
- 5
src/core/MidiInterface.cpp View File

@@ -627,17 +627,15 @@ void CCTextField::draw(NVGcontext *vg) {
text = std::to_string(*ccNum);
}
try {
*ccNum = std::stoi(text, NULL, 10);
*ccNum = std::stoi(text);
// Only allow valid cc numbers
if (*ccNum < 0 || *ccNum > 127) {
text = "";
begin = 0;
end = text.size();
begin = end = 0;
}
} catch (...) {
text = "";
begin = 0;
end = text.size();
begin = end = 0;
}
};
TextField::draw(vg);


Loading…
Cancel
Save