From 24545690f92a823b866c87caf1f99c86405af427 Mon Sep 17 00:00:00 2001 From: orboditilt Date: Thu, 4 Apr 2019 10:46:09 +0200 Subject: [PATCH] Fix a possible NullPointer --- src/main/java/de/orb/wiiu/rpxparser/RPXFile.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/main/java/de/orb/wiiu/rpxparser/RPXFile.java b/src/main/java/de/orb/wiiu/rpxparser/RPXFile.java index a388891..facff05 100644 --- a/src/main/java/de/orb/wiiu/rpxparser/RPXFile.java +++ b/src/main/java/de/orb/wiiu/rpxparser/RPXFile.java @@ -42,13 +42,7 @@ public class RPXFile { return elf_reader.sections() // .filter(section -> section instanceof ElfRelocationTable) // We want to check ElfRelocationTable sections .flatMap(section -> ((ElfRelocationTable) section).stream()) // Get all relocations - .flatMap(r -> { - ElfSymbol t = r.symbol().get(); - if (t != null) { - return Stream.of(t); - } - return Stream.empty(); - }) // Get symbols of relocations if existing + .flatMap(r -> r.symbol().isPresent() ? Stream.of(r.symbol().get()) : Stream.empty()) // Get symbols of relocations if existing .filter(symbol -> symbol.section().filter(s -> (s instanceof ElfImportsTable)).isPresent()) // Only keep symbols of ElfImportsTable section .map(symbol -> new RPLImport(symbol.name().orElseThrow(() -> new NoSuchElementException()), ((ElfImportsTable) symbol.section().get()).rplname())) // Map to RPLImport