mirror of https://github.com/apache/cassandra
Avoid NPE in TableViews.allViewsCfs when a table has no views
This commit is contained in:
parent
5984210d2e
commit
b40cb8e73c
|
|
@ -89,6 +89,9 @@ public class TableViews extends AbstractCollection<View>
|
||||||
|
|
||||||
public Iterable<ColumnFamilyStore> allViewsCfs()
|
public Iterable<ColumnFamilyStore> allViewsCfs()
|
||||||
{
|
{
|
||||||
|
if (views.isEmpty())
|
||||||
|
return Collections.emptyList();
|
||||||
|
|
||||||
Keyspace keyspace = Keyspace.open(baseTableMetadata.keyspace);
|
Keyspace keyspace = Keyspace.open(baseTableMetadata.keyspace);
|
||||||
return Iterables.transform(views, view -> keyspace.getColumnFamilyStore(view.getDefinition().name()));
|
return Iterables.transform(views, view -> keyspace.getColumnFamilyStore(view.getDefinition().name()));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue