This could be combined to

if (timeSeries != null && timeSeries.isEmpty) {
...
}