Skip to content

Commit

Permalink
fix: out of bound error in string when preview module
Browse files Browse the repository at this point in the history
FUNKTION, LABEL, PLAY string out of bound error
  • Loading branch information
roberChen authored and falkTX committed Jan 1, 2022
1 parent f037bca commit 9d5118b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
5 changes: 2 additions & 3 deletions src/FUNKTION.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,8 @@ struct FUNKTIONDisplay : TransparentWidget {
void drawLayer(const DrawArgs &args, int layer) override {
if (layer ==1) {
shared_ptr<Font> font = APP->window->loadFont(asset::plugin(pluginInstance, "res/LEDCalculator.ttf"));
std::string fD= module ? module->fctDesc : "sin";
std::string to_display = "";
for (int i=0; i<14; i++) to_display = to_display + fD[i];
std::string to_display= module ? module->fctDesc : "sin";
to_display.resize(14);
nvgFontSize(args.vg, 24);
nvgFontFaceId(args.vg, font->handle);
nvgTextLetterSpacing(args.vg, 0);
Expand Down
7 changes: 3 additions & 4 deletions src/LABEL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct LABEL : Module {
};


std::string fileDesc = "Right clic to write";
std::string fileDesc = "Right click to write";



Expand Down Expand Up @@ -71,9 +71,8 @@ struct LABELDisplay : TransparentWidget {
void drawLayer(const DrawArgs &args, int layer) override {
if (layer ==1) {
shared_ptr<Font> font = APP->window->loadFont(asset::plugin(pluginInstance, "res/LEDCalculator.ttf"));
std::string fD= module ? module->fileDesc : "Right clic to write";
std::string to_display = "";
for (int i=0; i<20; i++) to_display = to_display + fD[i];
std::string to_display= module ? module->fileDesc : "Right click to write";
to_display.resize(20);
nvgFontSize(args.vg, 24);
nvgFontFaceId(args.vg, font->handle);
nvgTextLetterSpacing(args.vg, 0);
Expand Down
5 changes: 2 additions & 3 deletions src/PLAY.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,8 @@ struct PLAYDisplay : TransparentWidget {
void drawLayer(const DrawArgs &args, int layer) override {
if (layer ==1) {
shared_ptr<Font> font = APP->window->loadFont(asset::plugin(pluginInstance, "res/LEDCalculator.ttf"));
std::string fD= module ? module->fileDesc : "load sample";
std::string to_display = "";
for (int i=0; i<14; i++) to_display = to_display + fD[i];
std::string to_display= module ? module->fileDesc : "load sample";
to_display.resize(14);
nvgFontSize(args.vg, 24);
nvgFontFaceId(args.vg, font->handle);
nvgTextLetterSpacing(args.vg, 0);
Expand Down

0 comments on commit 9d5118b

Please sign in to comment.