Changeset 18 in tmcsimulator-scriptbuilder for trunk/src/scriptbuilder/gui


Ignore:
Timestamp:
07/28/2017 02:32:08 PM (9 years ago)
Author:
bmcguffin
Message:

Resolved issue where a new event failed to be added to the incident when the user tried to add an event.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/scriptbuilder/gui/panels/IncidentTimelinePanel.java

    r7 r18  
    123123             * Check if click is out of bounds * 
    124124             */ 
    125             if (incident.slices.get(newSlice) == null || incident == null 
    126                     || newSlice < 0) 
     125            if (newSlice < 0 || incident == null) 
    127126            { 
    128127                return; 
    129128            } 
    130129 
    131             for (I_ScriptEvent se : incident.slices.get(newSlice).events) 
    132             { 
    133                 ed.addProperty(eventTypeToPropertyMap.get(se.getScriptEventType()), se); 
     130            if (incident.slices.get(newSlice) != null) 
     131 
     132            { 
     133                for (I_ScriptEvent se : incident.slices.get(newSlice).events) 
     134                { 
     135                    ed.addProperty(eventTypeToPropertyMap.get(se.getScriptEventType()), se); 
     136                } 
    134137            } 
    135138 
     
    143146                    I_ScriptEvent s = ScriptEvent.factoryByType(f.currentEventType); 
    144147                    ed.addProperty(eventTypeToPropertyMap.get(f.currentEventType), s); 
    145                     incident.slices.get(newSlice).addEvent(s); 
     148                    if (incident.slices.get(newSlice) == null) 
     149                    { 
     150                        incident.addNewEvent(s, newSlice); 
     151                    } 
     152                    else 
     153                    { 
     154                        incident.slices.get(newSlice).addEvent(s); 
     155                    } 
    146156                    f.update(f.getScript(), f.getScript()); 
    147157                } 
    148158            } 
    149159 
    150             ed.setVisible(true); 
     160            if (incident.slices.get(newSlice) != null) 
     161            { 
     162                ed.setVisible(true); 
     163            } 
    151164        } 
    152165 
Note: See TracChangeset for help on using the changeset viewer.