Merge "SQLiteCursor must be closed before throwing exception" into rvc-dev am: 2d3f5ecd4a

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/11983925

Change-Id: Ib6acbda99a2ff25ab600ac016d765f76a4dcea94
diff --git a/src/com/android/settings/slices/SlicesDatabaseAccessor.java b/src/com/android/settings/slices/SlicesDatabaseAccessor.java
index e31715d..c0bb8de 100644
--- a/src/com/android/settings/slices/SlicesDatabaseAccessor.java
+++ b/src/com/android/settings/slices/SlicesDatabaseAccessor.java
@@ -127,10 +127,12 @@
         int numResults = resultCursor.getCount();
 
         if (numResults == 0) {
+            resultCursor.close();
             throw new IllegalStateException("Invalid Slices key from path: " + path);
         }
 
         if (numResults > 1) {
+            resultCursor.close();
             throw new IllegalStateException(
                     "Should not match more than 1 slice with path: " + path);
         }