summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dealconvert/formats/__init__.py2
-rw-r--r--dealconvert/formats/bhg.py2
-rw-r--r--dealconvert/formats/dlm.py2
3 files changed, 4 insertions, 2 deletions
diff --git a/dealconvert/formats/__init__.py b/dealconvert/formats/__init__.py
index eea9fc6..9c37cf9 100644
--- a/dealconvert/formats/__init__.py
+++ b/dealconvert/formats/__init__.py
@@ -8,6 +8,8 @@ class DealFormat(object):
return self.parse_content(content)
def output(self, output_file, deal):
+ if not len(deal):
+ raise RuntimeError('Dealset is empty')
with open(output_file, 'wb') as out_file:
return self.output_content(out_file, deal)
diff --git a/dealconvert/formats/bhg.py b/dealconvert/formats/bhg.py
index 08b9213..6964ea3 100644
--- a/dealconvert/formats/bhg.py
+++ b/dealconvert/formats/bhg.py
@@ -40,7 +40,7 @@ class BHGFormat(DealFormat):
return deals
def output_content(self, out_file, dealset):
- lines = [''] * (max([board.number for board in dealset])+2)
+ lines = [''] * (max([board.number for board in dealset])+2) if len(dealset) else []
for deal in dealset:
line = ''
for hand in range(0, 4):
diff --git a/dealconvert/formats/dlm.py b/dealconvert/formats/dlm.py
index f99cde4..56f6e5d 100644
--- a/dealconvert/formats/dlm.py
+++ b/dealconvert/formats/dlm.py
@@ -66,7 +66,7 @@ class DLMFormat(DealFormat):
def output_content(self, out_file, dealset):
dealset = dealset[0:99]
board_numbers = [deal.number for deal in dealset]
- first_board = min(board_numbers)
+ first_board = min(board_numbers) if len(board_numbers) else 1
board_count = len(dealset)
for board in range(first_board, first_board+board_count):
if board not in board_numbers: