From ec662a709ad6d45e19d23f2ae357fad96a766c69 Mon Sep 17 00:00:00 2001 From: Brian Carlstrom Date: Tue, 10 Mar 2015 05:36:57 +0000 Subject: Revert "Remove unnecessary null checks in CloseGuard documentation sample code" This reverts commit 9a36fbb0df656b18a47048b7d49c09d129f8fcbb. Change-Id: I31f38d46daf7cd28f0d9babd200ee093928c0766 --- dalvik/src/main/java/dalvik/system/CloseGuard.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dalvik/src/main/java/dalvik/system/CloseGuard.java b/dalvik/src/main/java/dalvik/system/CloseGuard.java index 0301e50..df36867 100644 --- a/dalvik/src/main/java/dalvik/system/CloseGuard.java +++ b/dalvik/src/main/java/dalvik/system/CloseGuard.java @@ -40,7 +40,9 @@ package dalvik.system; * * protected void finalize() throws Throwable { * try { - * guard.warnIfOpen(); + * if (guard != null) { + * guard.warnIfOpen(); + * } * cleanup(); * } finally { * super.finalize(); @@ -74,7 +76,9 @@ package dalvik.system; * * protected void finalize() throws Throwable { * try { - * guard.warnIfOpen(); + * if (guard != null) { + * guard.warnIfOpen(); + * } * cleanup(); * } finally { * super.finalize(); -- cgit v1.1