Skip to content

Commit

Permalink
Update Observable.isInternalImplementation, get rid of NullPointerExc…
Browse files Browse the repository at this point in the history
…eption

NullPointerException has been encountered during my tests. It is because java.lang.Class.getPackage() may return null "... if no package information is available from the archive or codebase" (documented feature).
  • Loading branch information
nj4x committed Jul 4, 2013
1 parent aaaf4c9 commit 871561c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rxjava-core/src/main/java/rx/Observable.java
Original file line number Diff line number Diff line change
Expand Up @@ -3745,7 +3745,8 @@ private boolean isInternalImplementation(Object o) {
if (o instanceof AtomicObserver)
return true;
// we treat the following package as "internal" and don't wrap it
return o.getClass().getPackage().getName().startsWith("rx.operators");
Package p = o.getClass().getPackage(); // it can be null
return p != null && p.getName().startsWith("rx.operators");
}

public static class UnitTest {
Expand Down

0 comments on commit 871561c

Please sign in to comment.