Skip to content

Commit

Permalink
Update emulation.c
Browse files Browse the repository at this point in the history
- Adds error message for if a playlist isn't selected
  • Loading branch information
acegoal07 committed Jan 11, 2024
1 parent 45c8a02 commit 9ed8bef
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions scences/emulation.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ int32_t nfc_playlist_emulation_task(void* context) {
popup_set_context(nfc_playlist->popup, nfc_playlist);
view_dispatcher_switch_to_view(nfc_playlist->view_dispatcher, NfcPlaylistView_Popup);

if(file_stream_open(stream, furi_string_get_cstr(nfc_playlist->file_path), FSAM_READ, FSOM_OPEN_EXISTING)) {
if(file_stream_open(stream, furi_string_get_cstr(nfc_playlist->file_path), FSAM_READ, FSOM_OPEN_EXISTING) && nfc_playlist->file_selected) {
EmulationState = NfcPlaylistEmulationState_Emulating;
int file_position = 0;
while(stream_read_line(stream, line) && EmulationState == NfcPlaylistEmulationState_Emulating) {
Expand Down Expand Up @@ -144,7 +144,14 @@ int32_t nfc_playlist_emulation_task(void* context) {
popup_set_text(nfc_playlist->popup, "Press back", 64, 50, AlignCenter, AlignTop);
stop_blink(nfc_playlist);
EmulationState = NfcPlaylistEmulationState_Stopped;
} else {
}

else if (!nfc_playlist->file_selected) {
popup_set_header(nfc_playlist->popup, "No playlist selected", 64, 10, AlignCenter, AlignTop);
popup_set_text(nfc_playlist->popup, "Press back", 64, 50, AlignCenter, AlignTop);
}

else {
popup_set_header(nfc_playlist->popup, "Failed to open playlist", 64, 10, AlignCenter, AlignTop);
popup_set_text(nfc_playlist->popup, "Press back", 64, 50, AlignCenter, AlignTop);
}
Expand Down

0 comments on commit 9ed8bef

Please sign in to comment.