Commit 58329334 authored by Shenghou Ma's avatar Shenghou Ma Committed by Minux Ma

misc/swig/stdio: fix broken nil pointer test

SWIG has always returned a typed interface value for a C++ class,
so the interface value will never be nil even if the pointer itself
is NULL. ptr == NULL in C/C++ should be ptr.Swigcptr() == 0 in Go.

Fixes #9514.

Change-Id: I3778b91acf54d2ff22d7427fbf2b6ec9b9ce3b43
Reviewed-on: https://go-review.googlesource.com/2440Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 8c69ce0b
......@@ -10,7 +10,7 @@ import "testing"
// as expected.
func TestRead(t *testing.T) {
f := Fopen("file_test.go", "r")
if f == nil {
if f.Swigcptr() == 0 {
t.Fatal("fopen failed")
}
if Fgetc(f) != '/' || Fgetc(f) != '/' || Fgetc(f) != ' ' || Fgetc(f) != 'C' {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment