Skip to content

Commit aa8fa18

Browse files
committed
stationsList little fix
1 parent 5587637 commit aa8fa18

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

src/common.h

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2674,14 +2674,19 @@ class uniList {
26742674
}
26752675
void clearList(){
26762676
tft.fillRect(m_x, m_y, m_w, m_h, m_bgColor);
2677+
for(int i = 0; i < 10; i++){
2678+
free(m_txt[i]); m_txt[i] = strdup("");
2679+
free(m_ext[i]); m_ext[i] = strdup("");
2680+
m_nr[i] = -1;
2681+
}
26772682
}
26782683
void drawLine(uint8_t pos, const char* txt, const char* ext, const char* color = ANSI_ESC_WHITE, int16_t nr = -1){
26792684
if(pos > 9) return;
26802685
tft.setFont(m_fontSize);
26812686
if(m_mode == RADIO){
26822687
sprintf(m_buff, ANSI_ESC_YELLOW "%03d %s%s" , nr, color, txt);
2683-
if(txt){free(m_txt[pos]); m_txt[pos] = NULL; m_txt[pos] = strdup(txt);}
2684-
if(ext){free(m_ext[pos]); m_ext[pos] = NULL; m_ext[pos] = strdup(ext);}
2688+
if(txt){free(m_txt[pos]); m_txt[pos] = strdup(txt);}
2689+
if(ext){free(m_ext[pos]); m_ext[pos] = strdup(ext);}
26852690
m_nr[pos] = nr;
26862691
}
26872692
tft.writeText(m_buff, m_insert, m_y + pos *m_lineHight, m_w - 10, m_lineHight, TFT_ALIGN_LEFT, TFT_ALIGN_CENTER, true, true);
@@ -3530,7 +3535,22 @@ class fileList : public RegisterTable {
35303535
}
35313536
};
35323537
//——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
3533-
extern stationManagement staMgnt;
3538+
extern stationManagement staMgnt; /*
3539+
———————————————————————————————————————————————————————
3540+
| Stations List Vol3 01:16:32 | m_stationListPos
3541+
| 017 BGRADIOk | <-- 0
3542+
| 018 knixx.fm | <-- 1
3543+
| 019 -0N-Chrismas on Radio | <-- 2
3544+
| 020 BBC 6music | <-- 3
3545+
| 021 -0N-Movues on Radio | <-- 4
3546+
| 022 -0N-Top40 on Radio | <-- 5
3547+
| 023 Rockantenne Alternative (mp3) | <-- 6
3548+
| 024 Gra Wroclaw | <-- 7
3549+
| 025 Classic EuroDisco | <-- 8
3550+
| 026 Hit Radio FFH - Soundtrack (AAC+) | <-- 9
3551+
| 003 0:00 128K IP:192.168.178.24 |
3552+
———————————————————————————————————————————————————————
3553+
*/
35343554
class stationsList : public RegisterTable {
35353555
private:
35363556
int16_t m_x = 0;
@@ -3684,7 +3704,7 @@ class stationsList : public RegisterTable {
36843704
}
36853705
return;
36863706
}
3687-
3707+
if(myList.getNumberByPos(m_stationListPos) == -1) return;
36883708
if(m_oldX || m_oldY) return;
36893709
m_oldX = x; m_oldY = y;
36903710
m_browseOnRelease = 3; // pos has clicked

0 commit comments

Comments
 (0)