diff --git a/compiler.go b/compiler.go
index 799007e..b4bcb22 100644
--- a/compiler.go
+++ b/compiler.go
@@ -11,6 +11,8 @@ import (
 	"github.com/pkg/errors"
 )
 
+var ErrUnknownIdentifier = errors.New("unknown identifier")
+
 type compiler struct {
 	ctx     *Context
 	program *ast.Program
@@ -143,6 +145,9 @@ func (c *compiler) evalIfExpression(node *ast.IfExpression) (interface{}, error)
 	// fmt.Println("evalIfExpression")
 	con, err := c.evalExpression(node.Condition)
 	if err != nil {
+		if errors.Cause(err) == ErrUnknownIdentifier {
+			return nil, nil
+		}
 		return nil, errors.WithStack(err)
 	}
 
@@ -248,7 +253,7 @@ func (c *compiler) evalIdentifier(node *ast.Identifier) (interface{}, error) {
 	if node.Value == "nil" {
 		return nil, nil
 	}
-	return nil, errors.Errorf("could not find identifier '%s'", node.Value)
+	return nil, errors.Wrap(ErrUnknownIdentifier, node.Value)
 }
 
 func (c *compiler) evalInfixExpression(node *ast.InfixExpression) (interface{}, error) {
diff --git a/if_test.go b/if_test.go
index 348e3ca..dcc8015 100644
--- a/if_test.go
+++ b/if_test.go
@@ -49,8 +49,9 @@ func Test_Render_If_Or(t *testing.T) {
 func Test_Render_If_Nil(t *testing.T) {
 	r := require.New(t)
 	input := `<%= if (names && len(names) >= 1) { %>hi<%} %>`
-	_, err := Render(input, NewContext())
-	r.Error(err)
+	s, err := Render(input, NewContext())
+	r.NoError(err)
+	r.Equal("", s)
 }
 
 func Test_Render_If_Else_Return(t *testing.T) {
diff --git a/plush_test.go b/plush_test.go
index 8f4c8a8..4126918 100644
--- a/plush_test.go
+++ b/plush_test.go
@@ -342,7 +342,7 @@ func Test_UndefinedArg(t *testing.T) {
 
 	_, err := Render(input, ctx)
 	r.Error(err)
-	r.Contains(err.Error(), "could not find identifier 'bar'")
+	r.Equal(ErrUnknownIdentifier, errors.Cause(err))
 }
 
 func Test_RunScript(t *testing.T) {