Use a stub 'AuctionInfo' object, when we can't actually retrieve a real one, so that dozens of methods don't throw NPE's randomly in the moments when an auction is deleted, but the UI is trying to display the entry.
| 1013 | 1021 | |
|---|---|---|
| 1477 | 1477 | return r_flags; |
| 1478 | 1478 | } |
| 1479 | 1479 | |
| 1480 | private static AuctionInfo sAuction = new AuctionInfo(); | |
| 1481 | ||
| 1480 | 1482 | public AuctionInfo getAuction() { |
| 1481 | if(mAuction == null) { | |
| 1483 | if(mAuction == null || mAuction == sAuction) { | |
| 1482 | 1484 | String aid = get("auction_id"); |
| 1483 | 1485 | if(aid != null && aid.length() != 0) { |
| 1484 | 1486 | mAuction = AuctionInfo.findFirstBy("id", aid); |
| 1485 | 1487 | } |
| 1486 | if(mAuction == null && getString("identifier") != null) { | |
| 1488 | if((mAuction == null || mAuction == sAuction) && getString("identifier") != null) { | |
| 1487 | 1489 | mAuction = AuctionInfo.findByIdentifier(getString("identifier")); |
| 1488 | 1490 | } |
| 1489 | 1491 | |
| --- | --- | |
| 1499 | 1501 | } |
| 1500 | 1502 | } |
| 1501 | 1503 | |
| 1504 | if(mAuction == null) mAuction = sAuction; | |
| 1505 | ||
| 1502 | 1506 | return mAuction; |
| 1503 | 1507 | } |
| 1504 | 1508 | |
| --- | --- | |
| 1510 | 1514 | * @param inAI - The AuctionInfo object to make the new core data. Must not be null. |
| 1511 | 1515 | */ |
| 1512 | 1516 | public void setAuctionInfo(AuctionInfo inAI) { |
| 1513 | if(mAuction == null) { | |
| 1517 | if(mAuction == null || mAuction == sAuction) { | |
| 1514 | 1518 | setDefaultCurrency(inAI.getDefaultCurrency()); |
| 1515 | 1519 | } |
| 1516 | 1520 | |
| --- | --- | |
| 1682 | 1686 | /*************************/ |
| 1683 | 1687 | |
| 1684 | 1688 | public String saveDB() { |
| 1685 | if(mAuction == null) return null; | |
| 1689 | if(mAuction == null || mAuction == sAuction) return null; | |
| 1686 | 1690 | |
| 1687 | 1691 | String auctionId = mAuction.saveDB(); |
| 1688 | 1692 | if(auctionId != null) set("auction_id", auctionId); |
