Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GraphicalClient uses uninitialized field. #164

Open
mlhpdx opened this issue May 13, 2022 · 0 comments
Open

GraphicalClient uses uninitialized field. #164

mlhpdx opened this issue May 13, 2022 · 0 comments

Comments

@mlhpdx
Copy link

mlhpdx commented May 13, 2022

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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant