[1.0.0] Crash on loading Blueprint String missing a JSON key-value pair ("index":0)

This subforum contains all the issues which we already resolved.
Post Reply
Zarylo
Burner Inserter
Burner Inserter
Posts: 14
Joined: Sat Jan 06, 2018 12:51 am
Contact:

[1.0.0] Crash on loading Blueprint String missing a JSON key-value pair ("index":0)

Post by Zarylo »

In an effort to preserve my own time and sanity during multiplayer games I wrote a Haskell library for reading exported BP-Strings, decoding, decompressing, modifying, re-compressing and re-encoding them for finally importing them back into the game again.

While doing so, I created a new blueprint book layer and inserted a already existing root-level blueprint book into it (on JSON level) though I neglected to add the "index" key-value pair to the existing, now elevated blueprint book.
Don't judge me I work with JSON for the first time :mrgreen:

Code: Select all

{"blueprint_book":
	{"blueprints":
		[{"blueprint_book":
			{"blueprints":
				[{"blueprint_book":
					{"blueprints":
						[]
						,"item":"blueprint-book"
						,"label":"TEST2"
						,"description":"Test level 2"
						,"active_index":0
						,"version":281474976710656
					}
					,"index":0
				}]
				,"item":"blueprint-book"
				,"label":"TEST"
				,"description":"test level 1"
				,"active_index":0
				,"version":281474976710656
			}
			
		}]
		,"label":"Array"
		,"item":"blueprint-book"
		,"active_index":0
		,"version":281474976710656
	}
}

(root-level "blueprint_book" wrappers do not have an "index" key-value pair, while required for non root ones; according to the BP-String format . Thank you by the way for exposing the inner workings of the Strings. I appreciate it greatly.)

after compressing, encoding and appending that frontal 0 version byte; I imported the String and crashed the game, receiving a Read at address violation
factorio-current.log
Log file created on crash.
(26.5 KiB) Downloaded 115 times

Code: Select all

55942.246 Error CrashHandler.cpp:486: Access Violation: Read at address 000000000017FFF0
Most likely, Factorio tried to access the index value that was never created,

inserting

Code: Select all

,"index":0
on row 22 and retrying resulted in a successful import, no crashing.

I'm not sure how Wube wants to handle this kind of thing, it isn't their string output that created the error. However blerping a "JSON Format Error" Message rather than crashing the game might be considered a worthwhile improvement.

I don't think it matters but the used libraries are the aptly named base64 and zlib packages.
Attachments
out.txt
offending import String.
(217 Bytes) Downloaded 127 times
med.json
offending JSON File (as seen above). tabs and newlines added for human readability.
(582 Bytes) Downloaded 108 times

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [1.0.0] Crash on loading Blueprint String missing a JSON key-value pair ("index":0)

Post by Rseding91 »

Thanks for the report. It's now fixed for a future release.
If you want to get ahold of me I'm almost always on Discord.

Zarylo
Burner Inserter
Burner Inserter
Posts: 14
Joined: Sat Jan 06, 2018 12:51 am
Contact:

Re: [1.0.0] Crash on loading Blueprint String missing a JSON key-value pair ("index":0)

Post by Zarylo »

Cheers!

Post Reply

Return to “Resolved Problems and Bugs”