Fixed bug caused by switch to Optional usage, caused disk changes to not work properly

This commit is contained in:
Brendan Robert 2015-03-15 00:28:31 -05:00
parent a9132f8e76
commit 3231ac3f37

View File

@ -170,8 +170,8 @@ public class Apple2e extends Computer {
}
private void insertCard(Class<? extends Card> type, int slot) throws NoSuchMethodException, IllegalArgumentException, InvocationTargetException {
if (getMemory().getCard(slot) != null) {
if (getMemory().getCard(slot).getClass().equals(type)) {
if (getMemory().getCard(slot).isPresent()) {
if (getMemory().getCard(slot).get().getClass().equals(type)) {
return;
}
getMemory().removeCard(slot);