8305505: NPE in javazic compiler

Reviewed-by: naoto
This commit is contained in:
Yoshiki Sato 2023-05-02 12:42:15 +00:00 committed by Naoto Sato
parent ea9201f420
commit 544bd260b6

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -154,10 +154,10 @@ class GenDoc extends BackEnd {
outD.mkdirs(); outD.mkdirs();
/* If mapfile is available, add a link to the appropriate map */ /* If mapfile is available, add a link to the appropriate map */
if ((mapList == null) && (Main.getMapFile() != null)) { if (mapList == null && Main.getMapFile() != null) {
mapList = new HashMap<String, LatitudeAndLongitude>();
FileReader fr = new FileReader(Main.getMapFile()); FileReader fr = new FileReader(Main.getMapFile());
BufferedReader in = new BufferedReader(fr); BufferedReader in = new BufferedReader(fr);
mapList = new HashMap<String,LatitudeAndLongitude>();
String line; String line;
while ((line = in.readLine()) != null) { while ((line = in.readLine()) != null) {
// skip blank and comment lines // skip blank and comment lines
@ -180,7 +180,7 @@ class GenDoc extends BackEnd {
out.write(header1 + new Date() + header3 + zonename + header4); out.write(header1 + new Date() + header3 + zonename + header4);
out.write(body1 + "<FONT size=\"+2\"><B>" + zonename + "</B></FONT>"); out.write(body1 + "<FONT size=\"+2\"><B>" + zonename + "</B></FONT>");
LatitudeAndLongitude location = mapList.get(zonename); LatitudeAndLongitude location = (mapList != null ? mapList.get(zonename) : null);
if (location != null) { if (location != null) {
int deg, min, sec; int deg, min, sec;