Switch order of literals to prevent NullPointerException (#4)

Co-authored-by: pixeebot[bot] <23113631+pixeebot@users.noreply.github.com>
This commit is contained in:
pixeebot[bot]
2023-09-22 08:24:09 -04:00
committed by Hosted Weblate
parent aae1a4d65d
commit 83445cfde0
6 changed files with 12 additions and 12 deletions
@@ -494,7 +494,7 @@ public class KMLTrackExporter implements TrackExporter {
}
private void writeActivityType(String activityTypeLocalized) {
if (activityTypeLocalized == null || activityTypeLocalized.equals("")) {
if (activityTypeLocalized == null || "".equals(activityTypeLocalized)) {
return;
}
printWriter.println("<ExtendedData>");
@@ -415,7 +415,7 @@ public class KmlTrackImporter extends DefaultHandler implements XMLImporter.Trac
Float value = null;
if (content != null) {
content = content.trim();
if (!content.equals("")) {
if (!"".equals(content)) {
try {
value = Float.parseFloat(content);
} catch (NumberFormatException e) {
@@ -230,7 +230,7 @@ public class KmzTrackImporter {
*/
@Deprecated //TODO Use JDK9's inputStream.transferTo() instead of manual buffer
private void readAndSaveImageFile(ZipInputStream zipInputStream, Track.Id trackId, String fileName) throws IOException {
if (trackId == null || fileName.equals("")) {
if (trackId == null || "".equals(fileName)) {
return;
}
@@ -245,7 +245,7 @@ public class TrackListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
String category = activityType == null ? activityTypeLocalized : null;
String categoryDescription = StringUtils.getCategoryDescription(category, description);
viewBinding.trackListItemCategoryDescription.setText(categoryDescription);
viewBinding.trackListItemCategoryDescription.setVisibility(categoryDescription.equals("") ? View.GONE : View.VISIBLE);
viewBinding.trackListItemCategoryDescription.setVisibility("".equals(categoryDescription) ? View.GONE : View.VISIBLE);
setSelected(selection.get(getLayoutPosition()));
}
@@ -44,8 +44,8 @@ public class RecordingLayoutIO {
private static DataField fromCSV(String[] fieldParts, @NonNull Resources resources) {
return new DataField(
fieldParts[0],
fieldParts[1].equals(YES_VALUE),
fieldParts[2].equals(YES_VALUE),
YES_VALUE.equals(fieldParts[1]),
YES_VALUE.equals(fieldParts[2]),
fieldParts[0].equals(resources.getString(R.string.stats_custom_layout_coordinates_key)));
}