Skip to content

GraphicalClient uses uninitialized field. #164

@mlhpdx

Description

@mlhpdx

The line of code below will throw a null reference exception when attempting to use the GraphicalClient instead of TextClient in student ship programs:

cmd = (ShipCommand)shipType.getMethod("getNextCommand", Environment.class).invoke(ship, env);

The issue appears to be that instead of assigning to the field shipType at line 75 the code instead assigns to a local variable leaving the field with a null value:

Class<?> shipType = Class.forName(this.shipClassname);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions