Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Compat] StructureSpawn.renewCreep throws when undefined is passed as the creep #57

Open
Hexcede opened this issue Jan 27, 2022 · 0 comments

Comments

@Hexcede
Copy link

Hexcede commented Jan 27, 2022

When StructureSpawn.renewCreep is called with undefined as the creep value, it results in a runtime error in creep's checkCommon function.

Location of error in source (creep.ts)

This should have one additional check which ensures the creep value is defined, and if it isn't, it should return C.ERR_INVALID_TARGET as seen here (structures.js) in the original in-vm bindings, and here (creep.js) in the original intents processor.

Relevant stack trace:

Error: TypeError: Cannot read property 'my' of undefined
    at checkCommon (webpack:/module/xxscreeps/src/mods/creep/creep.ts:440:13)
    at webpack:/module/xxscreeps/src/mods/spawn/spawn.ts:276:9
    at chainIntentChecks (webpack:/module/xxscreeps/src/game/checks.ts:7:18)
    at checkRenewCreep (webpack:/module/xxscreeps/src/mods/spawn/spawn.ts:274:9)
    at webpack:/module/xxscreeps/src/mods/spawn/spawn.ts:157:10
    at chainIntentChecks (webpack:/module/xxscreeps/src/game/checks.ts:7:18)
    at StructureSpawn.renewCreep (webpack:/module/xxscreeps/src/mods/spawn/spawn.ts:156:10)
@Hexcede Hexcede changed the title [Bug] StructureSpawn.renewCreep throws when undefined is passed as the creep (creep.my) [Compat] StructureSpawn.renewCreep throws when undefined is passed as the creep (creep.my) Jan 27, 2022
@Hexcede Hexcede changed the title [Compat] StructureSpawn.renewCreep throws when undefined is passed as the creep (creep.my) [Compat] StructureSpawn.renewCreep throws when undefined is passed as the creep Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant