Revision: 15402
          http://sourceforge.net/p/skim-app/code/15402
Author:   hofman
Date:     2025-06-07 22:33:55 +0000 (Sat, 07 Jun 2025)
Log Message:
-----------
Combine statements wthin condition block. No need to check for count twice.

Modified Paths:
--------------
    trunk/SKMainWindowController.m

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2025-06-07 21:36:23 UTC (rev 15401)
+++ trunk/SKMainWindowController.m      2025-06-07 22:33:55 UTC (rev 15402)
@@ -1053,17 +1053,17 @@
     // notesToRemove is either [self notes], nil, or non Skim notes
     BOOL isAddOrReplace = [notesToRemove count] == 0 || [[notesToRemove 
firstObject] isSkimNote];
     PDFDocument *pdfDoc = [pdfView document];
-    NSMutableArray *widgetDicts = [NSMutableArray array];
+    NSMutableArray *widgetDicts = isAddOrReplace ? [NSMutableArray array] : 
nil;
     
     NSArray *notesAndPagesToAdd = [self 
annotationsAndPagesFromDictionaries:noteDicts forDocument:pdfDoc 
autoUpdate:isAddOrReplace == NO widgetDictionaries:widgetDicts];
     
-    if ([notesToRemove count] && isAddOrReplace) {
-        [pdfView removePDFToolTipRects];
-        // remove the current annotations
-        [pdfView setCurrentAnnotation:nil];
-    }
-    
     if (isAddOrReplace) {
+        if ([notesToRemove count]) {
+            [pdfView removePDFToolTipRects];
+            // remove the current annotations
+            [pdfView setCurrentAnnotation:nil];
+        }
+        
         if (notesToRemove && [widgets count]) {
             for (PDFAnnotation *widget in widgets) {
                 id origValue = [widgetValues objectForKey:widget];
@@ -1077,8 +1077,7 @@
         NSMapTable *values = [NSMapTable strongToStrongObjectsMapTable];
         for (PDFAnnotation *widget in widgets)
             [values setObject:[widget objectValue] forKey:widget];
-        if ([values count])
-            [self setWidgetValues:values];
+        [self setWidgetValues:values];
     }
     
     [self addAnnotations:notesAndPagesToAdd removeAnnotations:notesToRemove];

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to