[Colorlcd] Support model notes with spaces and prevent radio crash due to filename (#645)

* support both versions of model notes file name. Fix for #641

* Adding support for names with spaces

* Fix compilation
This commit is contained in:
eshifri
2021-09-02 10:45:58 +10:00
committed by GitHub
parent 9a2461c7e9
commit 88b8ac86fb
5 changed files with 58 additions and 10 deletions
+7 -1
View File
@@ -830,7 +830,13 @@ bool isTrainerModeAvailable(int mode)
bool modelHasNotes()
{
char filename[sizeof(MODELS_PATH)+1+sizeof(g_model.header.name)+sizeof(TEXT_EXT)] = MODELS_PATH "/";
char *buf = strcat_currentmodelname(&filename[sizeof(MODELS_PATH)]);
char *buf = strcat_currentmodelname(&filename[sizeof(MODELS_PATH)], 0);
strcpy(buf, TEXT_EXT);
if (isFileAvailable(filename)) {
return true;
}
buf = strcat_currentmodelname(&filename[sizeof(MODELS_PATH)], ' ');
strcpy(buf, TEXT_EXT);
if (isFileAvailable(filename)) {
return true;