Permalink
Browse files

fixed issue in which listing messages when db is empty throws invalid…

… index exception
  • Loading branch information...
1 parent 3a89ac5 commit afcf16012fc1cce5bcec2064329bfe9680967d87 @patrickbaumann committed Sep 14, 2011
Showing with 4 additions and 1 deletion.
  1. +4 −1 geocamTalk/models.py
View
5 geocamTalk/models.py
@@ -99,7 +99,10 @@ def getMessages(recipient=None, author=None):
@staticmethod
def getLargestMessageId():
- return TalkMessage.objects.all().order_by('-pk')[0].pk
+ try:
+ return TalkMessage.objects.all().order_by('-pk')[0].pk
+ except:
+ return 0
def has_audio(self):
return bool(self.audio_file != '')

0 comments on commit afcf160

Please sign in to comment.