Author: mguesdon
Date: Tue Jul  1 16:11:26 2014
New Revision: 37974

URL: http://svn.gna.org/viewcvs/gnustep?rev=37974&view=rev
Log:
* GSWeb/GSWHyperlink.m
  fix -appendAttribute:... for nil href value

Modified:
    libs/gsweb/trunk/ChangeLog
    libs/gsweb/trunk/GSWeb/GSWHyperlink.m

Modified: libs/gsweb/trunk/ChangeLog
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gsweb/trunk/ChangeLog?rev=37974&r1=37973&r2=37974&view=diff
==============================================================================
--- libs/gsweb/trunk/ChangeLog  (original)
+++ libs/gsweb/trunk/ChangeLog  Tue Jul  1 16:11:26 2014
@@ -1,3 +1,6 @@
+2014-07-01  Manuel Guesdon <[email protected]>
+       * GSWeb/GSWHyperlink.m
+         fix -appendAttribute:... for nil href value
 2014-06-11  Manuel Guesdon <[email protected]>
        * GSWeb/GSWAssociation.m
          fix EOValidatedObjectUserInfoKey value        

Modified: libs/gsweb/trunk/GSWeb/GSWHyperlink.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gsweb/trunk/GSWeb/GSWHyperlink.m?rev=37974&r1=37973&r2=37974&view=diff
==============================================================================
--- libs/gsweb/trunk/GSWeb/GSWHyperlink.m       (original)
+++ libs/gsweb/trunk/GSWeb/GSWHyperlink.m       Tue Jul  1 16:11:26 2014
@@ -366,69 +366,68 @@
 
       GSWResponse_appendContentCharacter(response,'"');
     } 
-  else if (_href != nil)
-    {
+  else
+    {
+      NSString* hrefValue = nil;
       GSWComponent * component = GSWContext_component(context);
-      NSString* hrefValue = [_href valueInComponent:component];
-
-      if (hrefValue==nil)
-       hrefValue=@"";
-      else 
-       hrefValue=NSStringWithObject(hrefValue);
-       
-      GSWResponse_appendContentCharacter(response,' ');
-      GSWResponse_appendContentAsciiString(response,href__Key);
-      GSWResponse_appendContentCharacter(response,'=');
-      GSWResponse_appendContentCharacter(response,'"');
-
-      if ([hrefValue isRelativeURL]
-         && ![hrefValue isFragmentURL])
-       {
-         NSString * url = [context _urlForResourceNamed:hrefValue
-                                   inFramework:nil];
-          if (url != nil)
-            GSWResponse_appendContentString(response,url);
-          else 
-           {
-             GSWResponse_appendContentAsciiString(response,[component 
baseURL]);
-             GSWResponse_appendContentCharacter(response,'/');
-             GSWResponse_appendContentString(response,hrefValue);
-           }
-        } 
-      else
-       {
-          GSWResponse_appendContentString(response,hrefValue);
-        }
-
-      [self _appendQueryStringToResponse:response 
-           inContext:context
-           requestHandlerPath:nil
-           htmlEscapeURL:YES];
-      
-      [self _appendFragmentToResponse: response
-           inContext:context];
-
-      GSWResponse_appendContentCharacter(response,'"');
-    }
-  else if (_fragmentIdentifier != nil)
-    {
-      GSWComponent * component = GSWContext_component(context);
-      id fragmentIdentifierValue = [_fragmentIdentifier 
valueInComponent:component];
-      if (fragmentIdentifierValue != nil)
-       {
+      if (_href != nil
+         && (hrefValue = [_href valueInComponent:component]) != nil)
+       {
+         hrefValue = NSStringWithObject(hrefValue);
+
          GSWResponse_appendContentCharacter(response,' ');
          GSWResponse_appendContentAsciiString(response,href__Key);
          GSWResponse_appendContentCharacter(response,'=');
          GSWResponse_appendContentCharacter(response,'"');
+         
+         if ([hrefValue isRelativeURL]
+             && ![hrefValue isFragmentURL])
+           {
+             NSString * url = [context _urlForResourceNamed:hrefValue
+                                       inFramework:nil];
+             if (url != nil)
+               GSWResponse_appendContentString(response,url);
+             else 
+               {
+                 GSWResponse_appendContentAsciiString(response,[component 
baseURL]);
+                 GSWResponse_appendContentCharacter(response,'/');
+                 GSWResponse_appendContentString(response,hrefValue);
+               }
+           } 
+         else
+           {
+             GSWResponse_appendContentString(response,hrefValue);
+           }
          
          [self _appendQueryStringToResponse:response 
                inContext:context
                requestHandlerPath:nil
                htmlEscapeURL:YES];
          
-         GSWResponse_appendContentCharacter(response,'#');
-         
GSWResponse_appendContentString(response,NSStringWithObject(fragmentIdentifierValue));
+         [self _appendFragmentToResponse: response
+               inContext:context];
+         
          GSWResponse_appendContentCharacter(response,'"');
+       }
+      else if (_fragmentIdentifier != nil)
+       {
+         id fragmentIdentifierValue = [_fragmentIdentifier 
valueInComponent:component];
+         if (fragmentIdentifierValue != nil)
+           {
+             GSWResponse_appendContentCharacter(response,' ');
+             GSWResponse_appendContentAsciiString(response,href__Key);
+             GSWResponse_appendContentCharacter(response,'=');
+             GSWResponse_appendContentCharacter(response,'"');
+             
+             [self _appendQueryStringToResponse:response 
+                   inContext:context
+                   requestHandlerPath:nil
+                   htmlEscapeURL:YES];
+             
+             GSWResponse_appendContentCharacter(response,'#');
+             
GSWResponse_appendContentString(response,NSStringWithObject(fragmentIdentifierValue));
+             GSWResponse_appendContentCharacter(response,'"');
+           }
        }
     }
 }


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to