Revision: 29383
          http://sourceforge.net/p/bibdesk/svn/29383
Author:   hofman
Date:     2025-07-28 14:30:05 +0000 (Mon, 28 Jul 2025)
Log Message:
-----------
set error when creating it

Modified Paths:
--------------
    trunk/bibdesk/BDSKEditor.m

Modified: trunk/bibdesk/BDSKEditor.m
===================================================================
--- trunk/bibdesk/BDSKEditor.m  2025-07-28 09:41:03 UTC (rev 29382)
+++ trunk/bibdesk/BDSKEditor.m  2025-07-28 14:30:05 UTC (rev 29383)
@@ -2096,7 +2096,6 @@
         return YES;
     
     BOOL isValid = YES;
-    NSError *err = nil;
     
     if (control == citeKeyField) {
         
@@ -2111,8 +2110,9 @@
                 else // shouldn't happen
                     message = NSLocalizedString(@"Cannot set this cite key as 
this would lead to a crossreff chain.", @"Informative text in alert dialog");
                 
-                err = [NSError mutableLocalErrorWithCode:kBDSKFailedToCommit 
localizedDescription:NSLocalizedString(@"Invalid Value", @"Message in alert 
dialog when entering an invalid value")];
+                NSError *err = [NSError 
mutableLocalErrorWithCode:kBDSKFailedToCommit 
localizedDescription:NSLocalizedString(@"Invalid Value", @"Message in alert 
dialog when entering an invalid value")];
                 [err setValue:message 
forKey:NSLocalizedRecoverySuggestionErrorKey];
+                *error = err;
             }
         } else {
             NSCharacterSet *invalidSet = [[BDSKTypeManager sharedManager] 
fragileCiteKeyCharacterSet];
@@ -2123,10 +2123,11 @@
                 
                 isValid = NO;
                 if (error) {
-                    err = [NSError 
mutableLocalErrorWithCode:kBDSKFailedToCommit 
localizedDescription:NSLocalizedString(@"Invalid Value", @"Message in alert 
dialog when entering an invalid value")];
+                    NSError *err = [NSError 
mutableLocalErrorWithCode:kBDSKFailedToCommit 
localizedDescription:NSLocalizedString(@"Invalid Value", @"Message in alert 
dialog when entering an invalid value")];
                     [err setValue:NSLocalizedString(@"The cite key you entered 
contains characters that could be invalid in TeX. Do you want to keep them or 
remove them?", @"Informative text in alert dialog") 
forKey:NSLocalizedRecoverySuggestionErrorKey];
                     [err setValue:self forKey:NSRecoveryAttempterErrorKey];
                     [err setValue:@[NSLocalizedString(@"Remove", @"Button 
title"), NSLocalizedString(@"Keep", @"Button title")] 
forKey:NSLocalizedRecoveryOptionsErrorKey];
+                    *error = err;
                 }
                 
             }
@@ -2154,8 +2155,9 @@
                         else if (errorCode == BDSKIsCrossreffedCrossrefError)
                             message = NSLocalizedString(@"Cannot set the 
Crossref field, as the current item is cross referenced.", @"Informative text 
in alert dialog");
                         
-                        err = [NSError 
mutableLocalErrorWithCode:kBDSKFailedToCommit 
localizedDescription:NSLocalizedString(@"Invalid Crossref Value", @"Message in 
alert dialog when entering an invalid Crossref key")];
+                        NSError *err = [NSError 
mutableLocalErrorWithCode:kBDSKFailedToCommit 
localizedDescription:NSLocalizedString(@"Invalid Crossref Value", @"Message in 
alert dialog when entering an invalid Crossref key")];
                         [err setValue:message 
forKey:NSLocalizedRecoverySuggestionErrorKey];
+                        *error = err;
                     }
                 }
             }
@@ -2162,9 +2164,6 @@
         }
     }
     
-    if (isValid == NO && error)
-        *error =err;
-    
     return isValid;
 }
 

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



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to