merge goyaml-omit-zero-pointers
diff --git a/encode_test.go b/encode_test.go
index a37adf9..50bd9bb 100644
--- a/encode_test.go
+++ b/encode_test.go
@@ -76,6 +76,10 @@
 		A int "a,omitempty"
 		B int "b,omitempty"
 	}{0, 0}},
+	{"{}\n", &struct {
+		A *struct{ X int } "a,omitempty"
+		B int              "b,omitempty"
+	}{nil, 0}},
 
 	// Flow flag
 	{"a: [1, 2]\n", &struct {
diff --git a/goyaml.go b/goyaml.go
index e7ba7a3..172164a 100644
--- a/goyaml.go
+++ b/goyaml.go
@@ -256,7 +256,7 @@
 	switch v.Kind() {
 	case reflect.String:
 		return len(v.String()) == 0
-	case reflect.Interface:
+	case reflect.Interface, reflect.Ptr:
 		return v.IsNil()
 	case reflect.Slice:
 		return v.Len() == 0