Skip to content

Commit

Permalink
fix: vocation crash
Browse files Browse the repository at this point in the history
  • Loading branch information
gpedro committed Feb 16, 2024
1 parent 0f006e6 commit 524a9b4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/database/players.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package database
import (
"database/sql"
"fmt"

"github.com/opentibiabr/login-server/src/configs"
"github.com/opentibiabr/login-server/src/grpc/login_proto_messages"
)
Expand All @@ -23,6 +24,7 @@ func LoadPlayers(db *sql.DB, acc *Account) ([]*login_proto_messages.Character, e

defer rows.Close()

vocations := configs.GetServerVocations()
for rows.Next() {
player := login_proto_messages.Character{
WorldId: 0,
Expand All @@ -47,7 +49,9 @@ func LoadPlayers(db *sql.DB, acc *Account) ([]*login_proto_messages.Character, e
acc.LastLogin = player.Info.LastLogin
}

player.Info.Vocation = configs.GetServerVocations()[vocation]
if vocation < len(vocations) {
player.Info.Vocation = vocations[vocation]
}

players = append(players, &player)
}
Expand Down

0 comments on commit 524a9b4

Please sign in to comment.