ocraft / ocraft-s2client

StarCraft II Client - Java library supported on Windows, Linux and Mac designed for building scripted bots and research using the SC2API.
MIT License
55 stars 15 forks source link

Crash using terran sensor tower #7

Closed Matoz closed 6 years ago

Matoz commented 6 years ago

Hi just discovered a crash when using the sensor tower as terran. When the first enemy unit enters the radius of the sensor tower there is a crash. I suspect units that are only blips do not habe a tag at first which is marked as required.

This is the stacktrace:

[ERROR] 2018-11-10 12:28:48.128 [RxComputationThreadPool-1] S2Controller - S2Controller.onError com.github.ocraft.s2client.api.ResponseParseException: java.lang.IllegalArgumentException: tag is required at com.github.ocraft.s2client.api.S2Client.prepareResponse(S2Client.java:191) ~[ocraft-s2client-api-0.2.7.jar:0.2.7] at io.reactivex.internal.operators.observable.ObservableMap$MapObserver.onNext(ObservableMap.java:59) ~[rxjava-2.1.9.jar:?] at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.tryEmit(ObservableFlatMap.java:262) ~[rxjava-2.1.9.jar:?] at io.reactivex.internal.operators.observable.ObservableFlatMap$InnerObserver.onNext(ObservableFlatMap.java:559) ~[rxjava-2.1.9.jar:?] at io.reactivex.internal.operators.observable.ObservableDoOnEach$DoOnEachObserver.onNext(ObservableDoOnEach.java:103) ~[rxjava-2.1.9.jar:?] at io.reactivex.internal.operators.observable.ObservableMap$MapObserver.onNext(ObservableMap.java:64) ~[rxjava-2.1.9.jar:?] at io.vertx.reactivex.core.impl.ObservableReadStream$Subscription.lambda$set$2(ObservableReadStream.java:61) ~[vertx-rx-java2-3.5.3.jar:3.5.3] at io.vertx.core.eventbus.impl.HandlerRegistration.deliver(HandlerRegistration.java:223) ~[vertx-core-3.5.3.jar:3.5.3] at io.vertx.core.eventbus.impl.HandlerRegistration.handle(HandlerRegistration.java:200) ~[vertx-core-3.5.3.jar:3.5.3] at io.vertx.core.eventbus.impl.EventBusImpl.lambda$deliverToHandler$3(EventBusImpl.java:533) ~[vertx-core-3.5.3.jar:3.5.3] at io.vertx.core.impl.ContextImpl.lambda$wrapTask$2(ContextImpl.java:339) ~[vertx-core-3.5.3.jar:3.5.3] at io.netty.util.concurrent.AbstractEventExecutor.safeExecute$$$capture(AbstractEventExecutor.java:163) ~[netty-common-4.1.19.Final.jar:4.1.19.Final] at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java) ~[netty-common-4.1.19.Final.jar:4.1.19.Final] at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404) ~[netty-common-4.1.19.Final.jar:4.1.19.Final] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463) ~[netty-transport-4.1.19.Final.jar:4.1.19.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886) ~[netty-common-4.1.19.Final.jar:4.1.19.Final] at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.19.Final.jar:4.1.19.Final] at java.lang.Thread.run(Thread.java:834) [?:?] Caused by: java.lang.IllegalArgumentException: tag is required at com.github.ocraft.s2client.protocol.Errors.lambda$required$0(Errors.java:38) ~[ocraft-s2client-protocol-0.2.7.jar:0.2.7] at java.util.Optional.orElseThrow(Optional.java:408) ~[?:?] at com.github.ocraft.s2client.protocol.unit.Unit.<init>(Unit.java:103) ~[ocraft-s2client-protocol-0.2.7.jar:0.2.7] at com.github.ocraft.s2client.protocol.unit.Unit.from(Unit.java:230) ~[ocraft-s2client-protocol-0.2.7.jar:0.2.7] at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[?:?] at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1654) ~[?:?] at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?] at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?] at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[?:?] at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?] at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[?:?] at com.github.ocraft.s2client.protocol.observation.raw.ObservationRaw.<init>(ObservationRaw.java:61) ~[ocraft-s2client-protocol-0.2.7.jar:0.2.7] at com.github.ocraft.s2client.protocol.observation.raw.ObservationRaw.from(ObservationRaw.java:77) ~[ocraft-s2client-protocol-0.2.7.jar:0.2.7] at java.util.Optional.map(Optional.java:265) ~[?:?] at com.github.ocraft.s2client.protocol.observation.Observation.<init>(Observation.java:85) ~[ocraft-s2client-protocol-0.2.7.jar:0.2.7] at com.github.ocraft.s2client.protocol.observation.Observation.from(Observation.java:108) ~[ocraft-s2client-protocol-0.2.7.jar:0.2.7] at java.util.Optional.map(Optional.java:265) ~[?:?] at com.github.ocraft.s2client.protocol.response.ResponseObservation.<init>(ResponseObservation.java:69) ~[ocraft-s2client-protocol-0.2.7.jar:0.2.7] at com.github.ocraft.s2client.protocol.response.ResponseObservation.from(ResponseObservation.java:81) ~[ocraft-s2client-protocol-0.2.7.jar:0.2.7] at com.github.ocraft.s2client.protocol.response.ResponseConverter.apply(ResponseConverter.java:70) ~[ocraft-s2client-protocol-0.2.7.jar:0.2.7] at com.github.ocraft.s2client.protocol.ResponseParser.apply(ResponseParser.java:40) ~[ocraft-s2client-protocol-0.2.7.jar:0.2.7] at com.github.ocraft.s2client.api.S2Client.prepareResponse(S2Client.java:187) ~[ocraft-s2client-api-0.2.7.jar:0.2.7] ... 17 more

ocraft_blip_issue

ocraft commented 6 years ago

Ok, units that only blips/unit without tags are not part of unit pool, there are in ObservationRaw.getUnitSnapshots.