Website Summary Files Commits Branches @commit @diff @stats
path: root / src / VenueConsoleUI.cpp
diff options
context:
space:
mode:
1 files changed, 6 insertions, 1 deletions
-rw-r--r--src/VenueConsoleUI.cpp7
diff --git a/src/VenueConsoleUI.cpp b/src/VenueConsoleUI.cpp
index 34bbf64..092ead4 100644
--- a/src/VenueConsoleUI.cpp
+++ b/src/VenueConsoleUI.cpp
@@ -50,8 +50,13 @@ void command_freeSeats() {
unsigned tableSize = hall->get_rowCount() * hall->get_seatsPerRow(),
nextTInd = 0, nextRInd = 0,
- nextT = (tickets[nextT].get_row() - 1) * hall->get_seatsPerRow() + tickets[nextT].get_seat() - 1,
+ nextT = 0, nextR = 0;
+
+ if (tickets.get_count() > 0)
+ nextT = (tickets[nextT].get_row() - 1) * hall->get_seatsPerRow() + tickets[nextT].get_seat() - 1;
+ if (reservations.get_count() > 0)
nextR = (reservations[nextR].get_ticket().get_row() - 1) * hall->get_seatsPerRow() + reservations[nextT].get_ticket().get_seat() - 1;
+
char tableData[tableSize + 1];
for (unsigned i = 0; i < tableSize; i++) {
if (nextTInd < tickets.get_count() && nextT == i) {