mirror of
https://github.com/nasa/openmct.git
synced 2024-12-19 21:27:52 +00:00
[Time Conductor] Avoid exception
Avoid exception when trying to generate a single datum in cases where there is no data yet available.
This commit is contained in:
parent
cbaf45afe9
commit
2848a8458b
@ -110,20 +110,23 @@ define(
|
||||
* Get the latest telemetry datum for this domain object. This
|
||||
* will be from real-time telemetry, unless an index is specified,
|
||||
* in which case it will be pulled from the historical telemetry
|
||||
* series at the specified index.
|
||||
* series at the specified index. If there is no latest available
|
||||
* datum, this will return undefined.
|
||||
*
|
||||
* @param {DomainObject} domainObject the object of interest
|
||||
* @param {number} [index] the index of the data of interest
|
||||
* @returns {TelemetryDatum} the most recent datum
|
||||
*/
|
||||
self.getDatum = function (telemetryObject, index) {
|
||||
function makeNewDatum(series) {
|
||||
return series ?
|
||||
subscription.makeDatum(telemetryObject, series, index) :
|
||||
undefined;
|
||||
}
|
||||
|
||||
return typeof index !== 'number' ?
|
||||
subscription.getDatum(telemetryObject) :
|
||||
subscription.makeDatum(
|
||||
telemetryObject,
|
||||
this.getSeries(telemetryObject),
|
||||
index
|
||||
);
|
||||
makeNewDatum(this.getSeries(telemetryObject));
|
||||
};
|
||||
|
||||
return self;
|
||||
|
Loading…
Reference in New Issue
Block a user