mirror of
https://github.com/nasa/openmct.git
synced 2025-05-06 10:38:23 +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
|
* Get the latest telemetry datum for this domain object. This
|
||||||
* will be from real-time telemetry, unless an index is specified,
|
* will be from real-time telemetry, unless an index is specified,
|
||||||
* in which case it will be pulled from the historical telemetry
|
* 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 {DomainObject} domainObject the object of interest
|
||||||
* @param {number} [index] the index of the data of interest
|
* @param {number} [index] the index of the data of interest
|
||||||
* @returns {TelemetryDatum} the most recent datum
|
* @returns {TelemetryDatum} the most recent datum
|
||||||
*/
|
*/
|
||||||
self.getDatum = function (telemetryObject, index) {
|
self.getDatum = function (telemetryObject, index) {
|
||||||
|
function makeNewDatum(series) {
|
||||||
|
return series ?
|
||||||
|
subscription.makeDatum(telemetryObject, series, index) :
|
||||||
|
undefined;
|
||||||
|
}
|
||||||
|
|
||||||
return typeof index !== 'number' ?
|
return typeof index !== 'number' ?
|
||||||
subscription.getDatum(telemetryObject) :
|
subscription.getDatum(telemetryObject) :
|
||||||
subscription.makeDatum(
|
makeNewDatum(this.getSeries(telemetryObject));
|
||||||
telemetryObject,
|
|
||||||
this.getSeries(telemetryObject),
|
|
||||||
index
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user