Revision: 12851
          http://sourceforge.net/p/skim-app/code/12851
Author:   hofman
Date:     2022-04-21 09:20:29 +0000 (Thu, 21 Apr 2022)
Log Message:
-----------
Need to check for zero length, as empty data is interpreted as an empty array

Modified Paths:
--------------
    trunk/SkimNotes/SKNUtilities.m

Modified: trunk/SkimNotes/SKNUtilities.m
===================================================================
--- trunk/SkimNotes/SKNUtilities.m      2022-04-20 21:40:06 UTC (rev 12850)
+++ trunk/SkimNotes/SKNUtilities.m      2022-04-21 09:20:29 UTC (rev 12851)
@@ -199,10 +199,11 @@
 NSArray *SKNSkimNotesFromData(NSData *data) {
     NSArray *noteDicts = nil;
     
-    if ([data length] > 8) {
+    if ([data length] > 0) {
         unsigned char ch = 0;
-        [data getBytes:&ch range:NSMakeRange(8, 1)];
-        ch = ch >> 4;
+        if ([data length] > 8)
+            [data getBytes:&ch range:NSMakeRange(8, 1)];
+        ch >>= 4;
         if (ch == 0xD) {
             @try { noteDicts = [NSKeyedUnarchiver 
unarchiveObjectWithData:data]; }
             @catch (id e) {}

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