Ensure values are reset between dictionary list entries

Julien LepillerTue Jul 20 03:01:11+0200 2021

1f7d7b9

Ensure values are reset between dictionary list entries

app/src/main/java/eu/lepiller/nani/dictionary/DictionaryFactory.java

9999
                String currentLanguage = "";
100100
                String lang = "";
101101
102-
                Dictionary d;
102+
                Dictionary d = null;
103103
                while((line = br.readLine()) != null) {
104104
                    if(line.isEmpty()) {
105105
                        // create dictionary

129129
                                    chooseLanguage(synopsis),
130130
                                    chooseLanguage(description),
131131
                                    cacheDir, url, size, entries, sha256, lang);
132-
                        } else {
133-
                            continue;
134132
                        }
135133
136-
                        if(d.isDownloaded()) {
137-
                            dictionaries.add(0, d);
138-
                        } else {
139-
                            dictionaries.add(d);
134+
                        if(d != null) {
135+
                            if (d.isDownloaded()) {
136+
                                dictionaries.add(0, d);
137+
                            } else {
138+
                                dictionaries.add(d);
139+
                            }
140140
                        }
141+
142+
                        synopsis = new HashMap<>();
143+
                        description = new HashMap<>();
144+
                        sha256 = "";
145+
                        size = 0;
146+
                        type = "";
147+
                        entries = 0;
148+
                        url = "";
149+
                        name = "";
150+
                        currentLanguage = "";
151+
                        lang = "";
152+
                        d = null;
141153
                    }
142154
143155
                    if(line.startsWith("[")) {