Refactor the nativePtr validation code to a method.

This will make testing much easier.

Bug: 117828816
Test: robotests
Change-Id: I1ca81e2005e559c0ec1e5f468cdd4bc0c21edbea
1 file changed