Revision: 14395
          http://sourceforge.net/p/skim-app/code/14395
Author:   hofman
Date:     2024-07-23 16:29:41 +0000 (Tue, 23 Jul 2024)
Log Message:
-----------
set script error when adding note without page

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

Modified: trunk/SKMainDocument.m
===================================================================
--- trunk/SKMainDocument.m      2024-07-23 16:23:52 UTC (rev 14394)
+++ trunk/SKMainDocument.m      2024-07-23 16:29:41 UTC (rev 14395)
@@ -1657,11 +1657,12 @@
 - (void)insertObject:(PDFAnnotation *)newNote 
inNotesAtIndex:(NSUInteger)anIndex {
     if ([[self pdfDocument] allowsNotes]) {
         PDFPage *page = [newNote page];
-        if (page && [[page annotations] containsObject:newNote] == NO) {
+        if (page == nil) {
+            [[NSScriptCommand currentCommand] 
setScriptErrorNumber:NSReceiversCantHandleCommandScriptError];
+            [[NSScriptCommand currentCommand] setScriptErrorString:@"New note 
needs to be added to a page."];
+        } else if ([[page annotations] containsObject:newNote] == NO) {
             [[self pdfDocument] addAnnotation:newNote toPage:page];
             [[self undoManager] setActionName:NSLocalizedString(@"Add Note", 
@"Undo action name")];
-        } else {
-            [[NSScriptCommand currentCommand] 
setScriptErrorNumber:NSReceiversCantHandleCommandScriptError];
         }
     }
 }

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



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to