check for existing actions when adding action timings

This commit is contained in:
Radu Ioan Fericean
2012-10-11 14:45:14 +03:00
parent 6c5a06b474
commit e2c7c74bf7

View File

@@ -398,14 +398,17 @@ func (csvr *CSVReader) LoadActionTimings(fn string, comma rune) (err error) {
// skip header line
continue
}
_, exists := csvr.actions[record[1]]
if !exists {
return errors.New(fmt.Sprintf("ActionTiming: Could not load the action for tag: %v", record[1]))
}
ts, exists := csvr.timings[record[2]]
if !exists {
return errors.New(fmt.Sprintf("Could not load the timing for tag: %v", record[2]))
return errors.New(fmt.Sprintf("ActionTiming: Could not load the timing for tag: %v", record[2]))
}
weight, err := strconv.ParseFloat(record[3], 64)
if err != nil {
return errors.New(fmt.Sprintf("Could not parse action timing weight: %v", err))
return errors.New(fmt.Sprintf("ActionTiming: Could not parse action timing weight: %v", err))
}
for _, t := range ts {
at := &ActionTiming{