prevent panic on setting nil deletion timestamp

pull/6/head
deads2k 2017-05-01 11:11:41 -04:00
parent 6ae80a6261
commit 0da5be47cf
1 changed files with 4 additions and 0 deletions

View File

@ -406,6 +406,10 @@ func (u *Unstructured) GetDeletionTimestamp() *metav1.Time {
} }
func (u *Unstructured) SetDeletionTimestamp(timestamp *metav1.Time) { func (u *Unstructured) SetDeletionTimestamp(timestamp *metav1.Time) {
if timestamp == nil {
u.setNestedField(nil, "metadata", "deletionTimestamp")
return
}
ts, _ := timestamp.MarshalQueryParameter() ts, _ := timestamp.MarshalQueryParameter()
u.setNestedField(ts, "metadata", "deletionTimestamp") u.setNestedField(ts, "metadata", "deletionTimestamp")
} }