Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Author Topic: ClassCastException Missile to Ship  (Read 2038 times)

Wyvern

  • Admiral
  • *****
  • Posts: 3786
    • View Profile
ClassCastException Missile to Ship
« on: May 22, 2017, 05:56:11 PM »

...I don't actually see any mod-specific code in the stack trace, but I'm willing to bet this isn't something that could happen under vanilla.
Code
 2495415 [Thread-6] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.ClassCastException: com.fs.starfarer.combat.entities.Missile cannot be cast to com.fs.starfarer.combat.entities.Ship
 java.lang.ClassCastException: com.fs.starfarer.combat.entities.Missile cannot be cast to com.fs.starfarer.combat.entities.Ship
at com.fs.starfarer.combat.ai.missile.MissileAI.<init>(Unknown Source)
at com.fs.starfarer.loading.specs.d.super(Unknown Source)
at com.fs.starfarer.loading.specs.d.super(Unknown Source)
at com.fs.starfarer.combat.entities.ship.super.J.super(Unknown Source)
at com.fs.starfarer.combat.entities.ship.super.J.fireProjectile(Unknown Source)
at com.fs.starfarer.combat.entities.ship.trackers.OoOO.String.super(Unknown Source)
at com.fs.starfarer.combat.entities.ship.trackers.OoOO.super(Unknown Source)
at com.fs.starfarer.combat.entities.ship.trackers.String.o00000(Unknown Source)
at com.fs.starfarer.combat.entities.ship.trackers.String.o00000(Unknown Source)
at com.fs.starfarer.combat.entities.ship.trackers.OoOO.String(Unknown Source)
at com.fs.starfarer.combat.entities.ship.super.J.advance(Unknown Source)
at com.fs.starfarer.combat.systems.G.Ò00000(Unknown Source)
at com.fs.starfarer.combat.systems.G.advance(Unknown Source)
at com.fs.starfarer.combat.entities.Ship.advance(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.advanceInner(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.advance(Unknown Source)
at com.fs.starfarer.combat.CombatState.traverse(Unknown Source)
at com.fs.state.AppDriver.begin(Unknown Source)
at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
at java.lang.Thread.run(Thread.java:744)
I've also got a save right before the battle where this happened, though it doesn't seem to happen reliably - at least, the first time around when I underdeployed, the game didn't crash before I decided that I needed to back up and try again with a bit more firepower.

And, in addition, I used this crash to verify: yes, I can get a heap dump while the error dialog is still up.  (I don't think that will be particularly relevant for this error, but if I see anything else that looks memory-issue-like, I can definitely grab the heap.)
Logged
Wyvern is 100% correct about the math.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: ClassCastException Missile to Ship
« Reply #1 on: May 22, 2017, 06:00:28 PM »

Yep, this can also happen in vanilla - fixed for .1.

And, in addition, I used this crash to verify: yes, I can get a heap dump while the error dialog is still up.  (I don't think that will be particularly relevant for this error, but if I see anything else that looks memory-issue-like, I can definitely grab the heap.)

Cool, thank you!
Logged

AxleMC131

  • Admiral
  • *****
  • Posts: 1722
  • Amateur World-Builder
    • View Profile
Re: ClassCastException Missile to Ship
« Reply #2 on: May 22, 2017, 08:32:27 PM »

Interesting. I had the same crash when testing a mission for The Silent Armada. Still not sure what's wrong, but I think it's something to do with the Flux Submunitions system.
Logged

Clockwork Owl

  • Admiral
  • *****
  • Posts: 790
    • View Profile
    • Starsector South Korean Community
Re: ClassCastException Missile to Ship
« Reply #3 on: May 29, 2017, 04:22:36 AM »

Uncertain if this is related, but I frequently get this while modding:
Code
47793 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.ClassCastException: com.fs.starfarer.combat.entities.Ship cannot be cast to com.fs.starfarer.combat.entities.E
java.lang.ClassCastException: com.fs.starfarer.combat.entities.Ship cannot be cast to com.fs.starfarer.combat.entities.E
at com.fs.starfarer.combat.E.super.O0OO.o00000(Unknown Source)
at com.fs.starfarer.combat.E.B.super(Unknown Source)
at com.fs.starfarer.combat.E.B.super(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.advanceInner(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.advance(Unknown Source)
at com.fs.starfarer.combat.CombatState.traverse(Unknown Source)
at com.fs.state.AppDriver.begin(Unknown Source)
at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Says I'm casting a Ship to E, which I have no idea what it is and certainly not casted.
I think I did no weird things except setting the CollisionClass of a ship to MISSILE_FF.

EDIT: setting that collisionClass was the problem.
« Last Edit: May 29, 2017, 04:43:04 AM by Aron0621 »
Logged