Skip to content

Commit 9ed8bef

Browse files
committed
Update emulation.c
- Adds error message for if a playlist isn't selected
1 parent 45c8a02 commit 9ed8bef

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

scences/emulation.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ int32_t nfc_playlist_emulation_task(void* context) {
6262
popup_set_context(nfc_playlist->popup, nfc_playlist);
6363
view_dispatcher_switch_to_view(nfc_playlist->view_dispatcher, NfcPlaylistView_Popup);
6464

65-
if(file_stream_open(stream, furi_string_get_cstr(nfc_playlist->file_path), FSAM_READ, FSOM_OPEN_EXISTING)) {
65+
if(file_stream_open(stream, furi_string_get_cstr(nfc_playlist->file_path), FSAM_READ, FSOM_OPEN_EXISTING) && nfc_playlist->file_selected) {
6666
EmulationState = NfcPlaylistEmulationState_Emulating;
6767
int file_position = 0;
6868
while(stream_read_line(stream, line) && EmulationState == NfcPlaylistEmulationState_Emulating) {
@@ -144,7 +144,14 @@ int32_t nfc_playlist_emulation_task(void* context) {
144144
popup_set_text(nfc_playlist->popup, "Press back", 64, 50, AlignCenter, AlignTop);
145145
stop_blink(nfc_playlist);
146146
EmulationState = NfcPlaylistEmulationState_Stopped;
147-
} else {
147+
}
148+
149+
else if (!nfc_playlist->file_selected) {
150+
popup_set_header(nfc_playlist->popup, "No playlist selected", 64, 10, AlignCenter, AlignTop);
151+
popup_set_text(nfc_playlist->popup, "Press back", 64, 50, AlignCenter, AlignTop);
152+
}
153+
154+
else {
148155
popup_set_header(nfc_playlist->popup, "Failed to open playlist", 64, 10, AlignCenter, AlignTop);
149156
popup_set_text(nfc_playlist->popup, "Press back", 64, 50, AlignCenter, AlignTop);
150157
}

0 commit comments

Comments
 (0)