[Bug]: An initiative list with no current entry logs an error on every change

Aperta Adatta ai principianti
#6,251 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@dwizard0 ci sta già lavorando.

Dal 14/11/2026.

  • #6252 di @dwizard0 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
75/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java
Ambito
game-dev

Direzione di ricerca

Inizia nella classe InitiativeList, dove insertToken, remove, move e sort chiamano ciascuna getTokenInitiative(getCurrent()), e in getTokenInitiative stesso, che registra come errore qualsiasi indice fuori intervallo. Per riprodurre, crea una lista con delle voci e senza voce corrente, poi copia una map e controlla il log. È completato quando una lista senza voce corrente non produce alcun log di errore e le altre operazioni continuano a comportarsi allo stesso modo.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Describe the Bug

InitiativeList logs an error whenever an entry is inserted, removed, moved or the list is sorted while no entry has the initiative:

ERROR ... getTokenInitiative: index = -1, size = 0

Each of those methods saves the current entry first with getTokenInitiative(getCurrent()). With no current entry, getCurrent() is -1, and getTokenInitiative logs any out-of-range index as an error. But no current entry is the normal state of a new or emptied list, and of any list before someone starts a round.

It happens a lot more than adding tokens by hand would suggest, because copying a map rebuilds its initiative list one insertToken at a time. A campaign copy is made for every autosave, and when a server starts, so a map with initiative entries and no current one logs one error per entry each time. My dedicated server logged it 933 times before I worked around it.

Nothing else goes wrong: the methods treat the null as "no current entry" correctly. It's only the log.

To Reproduce
  1. Add a few tokens to the initiative list of a map, without starting a round.
  2. Let the campaign autosave, or start a server with it.
  3. The log has one getTokenInitiative: index = -1 error per entry.
Expected Behaviour

No error. "No entry has the initiative" isn't an error.

MapTool Info

develop (445f76a1d)

Desktop

Ubuntu 24.04 LTS

Lingua principale
Java
Stelle
927
Fork
286
Merge medio
3g 17h
PR unite (30g)
94

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di RPTools/maptool

Tutte le issue di RPTools/maptool

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.