mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 07:32:32 +01:00
fix(handlers): add error handling for swallowed repo/service errors
Several handler files discarded errors from repository and service calls, creating nil-dereference risks and silent data corruption: - guild_adventure: 3 GetByCharID calls could panic on nil guild - gacha: GetGachaPoints silently returned zero balances on DB error - house: HasApplication called before nil check on guild; GetHouseContents error discarded with 7 return values - distitem: 3 distRepo calls had no error logging - guild_ops: Disband/Leave service errors were invisible - shop: gacha type/weight/fpoint lookups had no error logging - discord: bcrypt error could result in nil password being set
This commit is contained in:
@@ -27,7 +27,10 @@ func handleMsgMhfOperateGuild(s *Session, p mhfpacket.MHFPacket) {
|
||||
|
||||
switch pkt.Action {
|
||||
case mhfpacket.OperateGuildDisband:
|
||||
result, _ := s.server.guildService.Disband(s.charID, guild.ID)
|
||||
result, err := s.server.guildService.Disband(s.charID, guild.ID)
|
||||
if err != nil {
|
||||
s.logger.Error("Failed to disband guild", zap.Error(err))
|
||||
}
|
||||
response := 0
|
||||
if result != nil && result.Success {
|
||||
response = 1
|
||||
@@ -46,7 +49,10 @@ func handleMsgMhfOperateGuild(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint32(0)
|
||||
}
|
||||
case mhfpacket.OperateGuildLeave:
|
||||
result, _ := s.server.guildService.Leave(s.charID, guild.ID, characterGuildInfo.IsApplicant, guild.Name)
|
||||
result, err := s.server.guildService.Leave(s.charID, guild.ID, characterGuildInfo.IsApplicant, guild.Name)
|
||||
if err != nil {
|
||||
s.logger.Error("Failed to leave guild", zap.Error(err))
|
||||
}
|
||||
response := 0
|
||||
if result != nil && result.Success {
|
||||
response = 1
|
||||
|
||||
Reference in New Issue
Block a user