From 099e78ae5bf1efbaf1b0e7d749080dcf5ec69386 Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Fri, 1 Jun 2012 11:50:16 -0700 Subject: [PATCH] Fixed a crash related to rotation when recording audio --- .../todoroo/astrid/files/FilesControlSet.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/files/FilesControlSet.java b/astrid/plugin-src/com/todoroo/astrid/files/FilesControlSet.java index 04dae9233..8fc07da8e 100644 --- a/astrid/plugin-src/com/todoroo/astrid/files/FilesControlSet.java +++ b/astrid/plugin-src/com/todoroo/astrid/files/FilesControlSet.java @@ -77,21 +77,23 @@ public class FilesControlSet extends PopupControlSet { } public void refreshMetadata() { - TodorooCursor cursor = metadataService.query( - Query.select(Metadata.PROPERTIES) - .where(MetadataCriteria.byTaskAndwithKey(model.getId(), FileMetadata.METADATA_KEY))); - try { - files.clear(); - for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { - Metadata metadata = new Metadata(); - metadata.readFromCursor(cursor); - files.add(metadata); + if (model != null) { + TodorooCursor cursor = metadataService.query( + Query.select(Metadata.PROPERTIES) + .where(MetadataCriteria.byTaskAndwithKey(model.getId(), FileMetadata.METADATA_KEY))); + try { + files.clear(); + for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { + Metadata metadata = new Metadata(); + metadata.readFromCursor(cursor); + files.add(metadata); + } + } finally { + cursor.close(); } - } finally { - cursor.close(); + if (initialized) + afterInflate(); } - if (initialized) - afterInflate(); } @Override