signaux-faibles / opensignauxfaibles

Plateforme de détection des entreprises fragiles
https://beta.gouv.fr/startup/signaux-faibles.html
MIT License
8 stars 1 forks source link

L'import paydex peut paniquer à cause d'une ligne malformée dans la source #371

Open chrnin opened 3 years ago

chrnin commented 3 years ago

Dans le cas où le fichier contient une ligne de ce type:

;; jours;

On obtient cette erreur:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x90e35d]

goroutine 109 [running]:
github.com/signaux-faibles/opensignauxfaibles/lib/paydex.parsePaydexLine(0xc0210dc3c0, 0xc005108240, 0x4, 0x4, 0xc00038fe00, 0x0, 0x0)
        /home/christophe/Project/opensignauxfaibles/lib/paydex/main.go:98 +0x20d
github.com/signaux-faibles/opensignauxfaibles/lib/paydex.(*paydexParser).parseLine(0xfcd800, 0xc005108240, 0x4, 0x4, 0xc005108200)
        /home/christophe/Project/opensignauxfaibles/lib/paydex/main.go:77 +0x54
github.com/signaux-faibles/opensignauxfaibles/lib/paydex.(*paydexParser).ParseLines.func1(0xc005108240, 0x4, 0x4, 0xc005108200)
        /home/christophe/Project/opensignauxfaibles/lib/paydex/main.go:72 +0x52
github.com/signaux-faibles/opensignauxfaibles/lib/marshal.ParseLines(0xc015df0120, 0xc0259561b0, 0xc000673fb0)
        /home/christophe/Project/opensignauxfaibles/lib/marshal/parsingHelpers.go:58 +0x226
github.com/signaux-faibles/opensignauxfaibles/lib/paydex.(*paydexParser).ParseLines(0xfcd800, 0xc015df0120)
        /home/christophe/Project/opensignauxfaibles/lib/paydex/main.go:71 +0x5c
created by github.com/signaux-faibles/opensignauxfaibles/lib/marshal.runParserOnFile
        /home/christophe/Project/opensignauxfaibles/lib/marshal/parser.go:96 +0x1db