check that radio connection is non-null when painting radio traffic history
This commit is contained in:
parent
1c4b6afea3
commit
d8f31b6630
1 changed files with 12 additions and 7 deletions
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: TrafficVisualizerSkin.java,v 1.1 2009/08/27 13:59:48 fros4943 Exp $
|
* $Id: TrafficVisualizerSkin.java,v 1.2 2009/10/19 17:37:50 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.plugins.skins;
|
package se.sics.cooja.plugins.skins;
|
||||||
|
@ -119,6 +119,7 @@ public class TrafficVisualizerSkin implements VisualizerSkin {
|
||||||
|
|
||||||
if (showHistory) {
|
if (showHistory) {
|
||||||
RadioConnection[] past = radioMedium.getLastTickConnections();
|
RadioConnection[] past = radioMedium.getLastTickConnections();
|
||||||
|
if (past != null) {
|
||||||
for (RadioConnection con: past) {
|
for (RadioConnection con: past) {
|
||||||
history.add(con);
|
history.add(con);
|
||||||
}
|
}
|
||||||
|
@ -126,6 +127,7 @@ public class TrafficVisualizerSkin implements VisualizerSkin {
|
||||||
history.removeFirst();
|
history.removeFirst();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
visualizer.repaint();
|
visualizer.repaint();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -240,7 +242,10 @@ public class TrafficVisualizerSkin implements VisualizerSkin {
|
||||||
if (conns != null) {
|
if (conns != null) {
|
||||||
g.setColor(Color.BLACK);
|
g.setColor(Color.BLACK);
|
||||||
for (RadioConnection conn : conns) {
|
for (RadioConnection conn : conns) {
|
||||||
Radio source = conn.getSource();
|
if (conn == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Radio source = conn.getSource(); // XXX Must not be null!
|
||||||
Point sourcePoint = visualizer.transformPositionToPixel(source.getPosition());
|
Point sourcePoint = visualizer.transformPositionToPixel(source.getPosition());
|
||||||
for (Radio destRadio : conn.getDestinations()) {
|
for (Radio destRadio : conn.getDestinations()) {
|
||||||
if (destRadio == null) {
|
if (destRadio == null) {
|
||||||
|
|
Loading…
Reference in a new issue