Skip to content

Commit 61e029e

Browse files
committed
Fix NRE on Veiw cloning
It will almost never appear in real life but in tests it can be. Since we extract views anyway cloning should work too
1 parent f1a1651 commit 61e029e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Orm/Xtensive.Orm/Orm/Upgrade/Internals/CatalogCloner.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,9 @@ private void CloneViews(Schema newSchema, Schema sourceSchema)
157157
var newView = newSchema.CreateView(sourceView.Name);
158158
CopyDbName(newView, sourceView);
159159
newView.CheckOptions = sourceView.CheckOptions;
160-
newView.Definition = (SqlNative) sourceView.Definition.Clone();
160+
if (sourceView.Definition != null) {
161+
newView.Definition = (SqlNative) sourceView.Definition.Clone();
162+
}
161163
CloneViewColumns(newView, sourceView);
162164
CloneIndexes(newView, sourceView);
163165
}

0 commit comments

Comments
 (0)