mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-03-08 00:49:26 +00:00
[AB-xxx] fixing not being able to delete a giveaway key for which there is no giveaway
This commit is contained in:
@@ -58,7 +58,9 @@ public class GiveawayKeyManagementServiceBean implements GiveawayKeyManagementSe
|
|||||||
@Override
|
@Override
|
||||||
public void deleteById(Long id, Long serverId) {
|
public void deleteById(Long id, Long serverId) {
|
||||||
GiveawayKey key = giveawayKeyRepository.findById(new GiveawayKeyId(id, serverId)).orElseThrow(GiveawayKeyNotFoundException::new);
|
GiveawayKey key = giveawayKeyRepository.findById(new GiveawayKeyId(id, serverId)).orElseThrow(GiveawayKeyNotFoundException::new);
|
||||||
|
if(key.getGiveaway() != null) {
|
||||||
key.getGiveaway().setGiveawayKey(null);
|
key.getGiveaway().setGiveawayKey(null);
|
||||||
|
}
|
||||||
giveawayKeyRepository.delete(key);
|
giveawayKeyRepository.delete(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user