FactoryPlanner icon indicating copy to clipboard operation
FactoryPlanner copied to clipboard

Crash when changing product values via "set product amount"

Open DripThanos opened this issue 1 year ago • 5 comments

Problem Description

Hello. I am playing on a server with a few friends and this crash occurred when i edited a product amount via "target amount"

Error ServerMultiplayerManager.cpp:92: MultiplayerManager failed: "The mod Factory Planner (1.1.75) caused a non-recoverable error.
Please report this error to the mod author.
Error while running event factoryplanner::Custom event (ID 304)
__factoryplanner__/ui/main/production_handler.lua:221: attempt to perform arithmetic on field 'percentage' (a nil value)
stack traceback:
        __factoryplanner__/ui/main/production_handler.lua:221: in function '?'
        __factoryplanner__/ui/dialogs/generic_dialogs.lua:211: in function 'dialog_close'
        __factoryplanner__/ui/base/modal_dialog.lua:187: in function 'exit'
        __factoryplanner__/ui/event_handler.lua:216: in function <__factoryplanner__/ui/event_handler.lua:189>
        [C]: in function 'raise_event'
        __factoryplanner__/util/raise.lua:27: in function 'close_dialog'
        __factoryplanner__/ui/base/modal_dialog.lua:285: in function 'handler'
        __factoryplanner__/ui/event_handler.lua:157: in function <__factoryplanner__/ui/event_handler.lua:114>
stack traceback:
        [C]: in function 'raise_event'
        __factoryplanner__/util/raise.lua:27: in function 'close_dialog'
        __factoryplanner__/ui/base/modal_dialog.lua:285: in function 'handler'
        __factoryplanner__/ui/event_handler.lua:157: in function <__factoryplanner__/ui/event_handler.lua:114>"

I tested it in singleplayer, producing the same error. Note that i am using krastorio 2, and it seems to happen with the specific factory im using. The factory string will be included in the reproduction section of the report.

Reproduction

  1. Start a world
  2. Open factory planner, and import the following string (requires krastorio 2) https://pastebin.com/g2QeYcHx
  3. in the production section, right click to specify amount on "Basic Tech Card", before changing the target amount to any value other than 120 (tested with 60, and 0)

DripThanos avatar Nov 27 '23 04:11 DripThanos

note that i have not tested it with other products, only the basic tech card

DripThanos avatar Nov 27 '23 04:11 DripThanos

Hm seems I can't reproduce it with your export string alone, probably because it's caused by something being weird in your save file. If you still have it, could you get it to me? That'd really help.

ClaudeMetz avatar Dec 05 '23 09:12 ClaudeMetz

I got the same error on version 1.1.78. Here are steps to reproduce:

  1. In a new game, make a new factory for iron chests, and make it using its only recipe
  2. Now make a subfactory for this recipe, and make iron plates using its only recipe
  3. Adjust the number of iron plates made in the subfactory (by right-clicking the product icon)
  4. Adjust the number of iron chests made in the main factory
  5. Crash happens

(note: the order of these steps is important, and every step seems to be necessary - e.g. not creating a subfactory will not crash the game)

fpvandoorn avatar Dec 18 '23 14:12 fpvandoorn

Thanks for the details, I'll give that a try.

ClaudeMetz avatar Dec 19 '23 21:12 ClaudeMetz

I also ran into this bug when changing the amount of an item with a subfactory attached.

Screenshot_2024-01-02-13-10-44

msrd0 avatar Jan 02 '24 12:01 msrd0