mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-03-05 07:59:36 +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
|
||||
public void deleteById(Long id, Long serverId) {
|
||||
GiveawayKey key = giveawayKeyRepository.findById(new GiveawayKeyId(id, serverId)).orElseThrow(GiveawayKeyNotFoundException::new);
|
||||
key.getGiveaway().setGiveawayKey(null);
|
||||
if(key.getGiveaway() != null) {
|
||||
key.getGiveaway().setGiveawayKey(null);
|
||||
}
|
||||
giveawayKeyRepository.delete(key);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user