Fix placeAdvert error in Scoop.lua#6335
Conversation
|
Cool! Looks like the issue may have been introduced in #6313 |
|
Not sure I understand what is triggering the issue? It's trying to place an advert on a station that doesn't exist? Under what condition did the bug trigger? |
|
@impaktor I was flying from one station to another. I was in one of the Gliese systems. I am not familiar with the advert functionality. |
|
For context, this crash happened alongside this error message popping up. May or may not be related, but the info may be helpful: https://bugzilla.redhat.com/show_bug.cgi?id=2463136 |
|
Hello. Can this patch be ported to current stable release 20260203? |
|
As per this comment I believe a release with recent bugfixes is planned to be released soon. |
|
Hi - when addressing a Lua error, you should make an effort to upload the This patch does catch the nil dereference, but does not resolve the semantic issue in the code - the line Instead, the line local p = station:GetSystemBody().parent.bodyYou may then check whether |
This should fix an error I just got which crashed the game: ``` Pioneer Warning [T] modules/Scoop/Scoop.lua:505: attempt to index local 'p' (a nil value) stack traceback: [T] modules/Scoop/Scoop.lua:505: in function 'placeAdvert' [T] modules/Scoop/Scoop.lua:561: in function 'makeAdvert [T] modules/Scoop/Scoop.lua:579: in function 'func' [T] libs/Event.lua:31: in function 'executor' [T] libs/Event.lua:79: in function '_Emit' [T] libs/Event.lua:209: in function <[T] libs/Event.lua:208> OK ```
|
Thank you, and yes I apologize I am unfamiliar with the semantics of this code. If you decide to make your own patch for this that would make sense as well. Sorry I don't have logs or a way to reproduce this - if it happens again I will dig deeper. |
sturnclaw
left a comment
There was a problem hiding this comment.
Thank you, and yes I apologize I am unfamiliar with the semantics of this code. If you decide to make your own patch for this that would make sense as well. Sorry I don't have logs or a way to reproduce this - if it happens again I will dig deeper.
There is no need to apologize! I appreciate the initiative in submitting the original patch, and I certainly don't expect you (as a new contributor) to know the context involved in this particular bit of code that would be required to catch the semantic error.
The new patch looks good, thanks for your time and effort on the matter. Don't worry about the log in this case if you're unable to reproduce it reliably; in this case the error location is enough to diagnose the obvious issue and fix it.
This should fix an error I just got which crashed the game: