projects
/
deliverable
/
tracecompass.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add null-checks for Map.get()
[deliverable/tracecompass.git]
/
ctf
/
org.eclipse.tracecompass.ctf.core
/
src
/
org
/
eclipse
/
tracecompass
/
ctf
/
core
/
trace
/
CTFTrace.java
diff --git
a/ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFTrace.java
b/ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFTrace.java
index 9d82709e13cd247e4180beeda48d6dafa2dc578a..2ef8fec142e60aa8f98e41a5c995974657660443 100644
(file)
--- a/
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFTrace.java
+++ b/
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFTrace.java
@@
-221,7
+221,11
@@
public class CTFTrace implements IDefinitionScope {
* @return The list of event declarations
*/
public Collection<IEventDeclaration> getEventDeclarations(Long streamId) {
* @return The list of event declarations
*/
public Collection<IEventDeclaration> getEventDeclarations(Long streamId) {
- return fStreams.get(streamId).getEventDeclarations();
+ CTFStream stream = fStreams.get(streamId);
+ if (stream == null) {
+ return null;
+ }
+ return stream.getEventDeclarations();
}
/**
}
/**
@@
-798,14
+802,12
@@
public class CTFTrace implements IDefinitionScope {
* The file must exist
*/
public void addStream(long id, File streamFile) throws CTFException {
* The file must exist
*/
public void addStream(long id, File streamFile) throws CTFException {
- CTFStream stream = null;
final File file = streamFile;
if (file == null) {
throw new CTFException("cannot create a stream with no file"); //$NON-NLS-1$
}
final File file = streamFile;
if (file == null) {
throw new CTFException("cannot create a stream with no file"); //$NON-NLS-1$
}
- if (fStreams.containsKey(id)) {
- stream = fStreams.get(id);
- } else {
+ CTFStream stream = fStreams.get(id);
+ if (stream == null) {
stream = new CTFStream(this);
fStreams.put(id, stream);
}
stream = new CTFStream(this);
fStreams.put(id, stream);
}
This page took
0.03892 seconds
and
5
git commands to generate.