mirror of
https://github.com/wiiu-env/RPXParserLib.git
synced 2024-06-01 08:58:45 +02:00
Fix a possible NullPointer
This commit is contained in:
parent
02ed1841f0
commit
24545690f9
|
@ -42,13 +42,7 @@ public class RPXFile {
|
||||||
return elf_reader.sections() //
|
return elf_reader.sections() //
|
||||||
.filter(section -> section instanceof ElfRelocationTable) // We want to check ElfRelocationTable sections
|
.filter(section -> section instanceof ElfRelocationTable) // We want to check ElfRelocationTable sections
|
||||||
.flatMap(section -> ((ElfRelocationTable) section).stream()) // Get all relocations
|
.flatMap(section -> ((ElfRelocationTable) section).stream()) // Get all relocations
|
||||||
.flatMap(r -> {
|
.flatMap(r -> r.symbol().isPresent() ? Stream.of(r.symbol().get()) : Stream.empty()) // Get symbols of relocations if existing
|
||||||
ElfSymbol t = r.symbol().get();
|
|
||||||
if (t != null) {
|
|
||||||
return Stream.of(t);
|
|
||||||
}
|
|
||||||
return Stream.empty();
|
|
||||||
}) // Get symbols of relocations if existing
|
|
||||||
.filter(symbol -> symbol.section().filter(s -> (s instanceof ElfImportsTable)).isPresent()) // Only keep symbols of ElfImportsTable section
|
.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()),
|
.map(symbol -> new RPLImport(symbol.name().orElseThrow(() -> new NoSuchElementException()),
|
||||||
((ElfImportsTable) symbol.section().get()).rplname())) // Map to RPLImport
|
((ElfImportsTable) symbol.section().get()).rplname())) // Map to RPLImport
|
||||||
|
|
Loading…
Reference in New Issue
Block a user