Emeg Fix : While Lottery is None , Program will crash

This commit is contained in:
Jerry Yan 2019-02-01 16:44:38 +08:00
parent ebe01566c0
commit 89edd10dc2

6
api.py
View File

@ -189,9 +189,10 @@ class XiGuaLiveApi:
self.onLike(User(i)) self.onLike(User(i))
else: else:
pass pass
self.lottery = Lottery(i) if self.lottery is None or self.lottery.ID == 0:
self.lottery = Lottery(i)
self._updRoomCount += 1 self._updRoomCount += 1
if self.lottery is not None or self.lottery.ID != 0: if self.lottery is not None and self.lottery.ID != 0:
self.lottery.update() self.lottery.update()
if self.lottery.isFinished: if self.lottery.isFinished:
self.onLottery(self.lottery) self.onLottery(self.lottery)
@ -204,7 +205,6 @@ class XiGuaLiveApi:
if __name__ == "__main__": if __name__ == "__main__":
name = "永恒de草薙" name = "永恒de草薙"
# name = "尤美"
if len(sys.argv) > 2: if len(sys.argv) > 2:
if sys.argv[-1] == "d": if sys.argv[-1] == "d":
DEBUG = True DEBUG = True