Fixed redstone card T2 in servers, closes #680.

Fixed potential NPE in descriptor packet generation for computer cases.
Ignore bad pwchar input (zero length strings).
This commit is contained in:
Florian Nücke 2014-11-20 06:42:56 +01:00
parent 1973ffa6cc
commit ba27aab3bb
3 changed files with 6 additions and 3 deletions

View File

@ -126,7 +126,7 @@ function term.read(history, dobreak, hint, pwchar)
end
local hintCache, hintIndex
if pwchar then
if pwchar and unicode.len(pwchar) > 0 then
pwchar = unicode.sub(pwchar, 1, 1)
end

View File

@ -1,6 +1,7 @@
package li.cil.oc.common.inventory
import li.cil.oc.OpenComputers
import li.cil.oc.api
import li.cil.oc.api.Driver
import li.cil.oc.api.driver.EnvironmentHost
import li.cil.oc.api.driver.{Item => ItemDriver}
@ -59,6 +60,8 @@ trait ComponentInventory extends Inventory with network.Environment {
}
}
}
// Make sure our node is connected.
api.Network.joinNewNetwork(node)
components collect {
case Some(component) => connectItemNode(component.node)
}

View File

@ -107,7 +107,7 @@ class ServerRack extends traits.PowerAcceptor with traits.Hub with traits.PowerB
def hasAbstractBusCard = servers exists {
case Some(server) => server.machine.isRunning && server.inventory.items.exists {
case Some(stack) => DriverAbstractBusCard.worksWith(stack, getClass)
case Some(stack) => DriverAbstractBusCard.worksWith(stack, server.getClass)
case _ => false
}
case _ => false
@ -115,7 +115,7 @@ class ServerRack extends traits.PowerAcceptor with traits.Hub with traits.PowerB
def hasRedstoneCard = servers exists {
case Some(server) => server.machine.isRunning && server.inventory.items.exists {
case Some(stack) => DriverRedstoneCard.worksWith(stack, getClass)
case Some(stack) => DriverRedstoneCard.worksWith(stack, server.getClass)
case _ => false
}
case _ => false