mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-17 11:15:12 -04:00
Fixed highly unlikely, non-critical NPE in machine (could happen in the very rare case that an executor thread started while the machine was being removed from the network, leading it to run while the machine is unconnected - that's still possible, but non-critical; it'll just stop/silently error and stop now).
This commit is contained in:
parent
db05a22430
commit
13a8dde8a6
@ -255,7 +255,7 @@ class Machine(val host: MachineHost) extends prefab.ManagedEnvironment with mach
|
|||||||
})
|
})
|
||||||
|
|
||||||
override def invoke(address: String, method: String, args: Array[AnyRef]) =
|
override def invoke(address: String, method: String, args: Array[AnyRef]) =
|
||||||
Option(node.network.node(address)) match {
|
if (node != null && node.network != null) Option(node.network.node(address)) match {
|
||||||
case Some(component: Component) if component.canBeSeenFrom(node) || component == node =>
|
case Some(component: Component) if component.canBeSeenFrom(node) || component == node =>
|
||||||
val direct = component.annotation(method).direct
|
val direct = component.annotation(method).direct
|
||||||
if (direct && architecture.isInitialized) {
|
if (direct && architecture.isInitialized) {
|
||||||
@ -264,6 +264,11 @@ class Machine(val host: MachineHost) extends prefab.ManagedEnvironment with mach
|
|||||||
component.invoke(method, this, args: _*)
|
component.invoke(method, this, args: _*)
|
||||||
case _ => throw new IllegalArgumentException("no such component")
|
case _ => throw new IllegalArgumentException("no such component")
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// Not really, but makes the VM stop, which is what we want in this case,
|
||||||
|
// because it means we've been disconnected / disposed already.
|
||||||
|
throw new LimitReachedException()
|
||||||
|
}
|
||||||
|
|
||||||
override def invoke(value: Value, method: String, args: Array[AnyRef]): Array[AnyRef] = Callbacks(value).get(method) match {
|
override def invoke(value: Value, method: String, args: Array[AnyRef]): Array[AnyRef] = Callbacks(value).get(method) match {
|
||||||
case Some(callback) =>
|
case Some(callback) =>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user