From b40563ab22c14d2862d9d9a1ff638e9f22e7975c Mon Sep 17 00:00:00 2001 From: PartialVolume <22084881+PartialVolume@users.noreply.github.com> Date: Fri, 4 Aug 2023 17:14:39 +0100 Subject: [PATCH] PDFGen29 Fix incorrect customer deletion/selection When using backspace or esc to abort customer deletion, first customer in list would incorrectly be deleted. Corrected by this fix. Also when aborting customer selection, first customer in list would be automatically selected. Also corrected by this fix. --- src/customers.c | 5 ++++- src/gui.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/customers.c b/src/customers.c index 0f9560a..9097d24 100644 --- a/src/customers.c +++ b/src/customers.c @@ -198,7 +198,10 @@ void delete_customer( int count, char** customer_list_array ) nwipe_gui_list( count, window_title, customer_list_array, &selected_entry ); - delete_customer_csv_entry( &selected_entry ); + if( selected_entry != 0 ) + { + delete_customer_csv_entry( &selected_entry ); + } } void write_customer_csv_entry( char* customer_name, diff --git a/src/gui.c b/src/gui.c index b79a121..b3c57ae 100644 --- a/src/gui.c +++ b/src/gui.c @@ -3885,7 +3885,7 @@ void nwipe_gui_list( int count, char* window_title, char** list, int* selected_e case KEY_BACKSPACE: case KEY_LEFT: case 127: - *selected_entry = 1; + *selected_entry = 0; return; break;