Fossil SCM
Guard against null event types.
Commit
b0b3d9d9f49448ad5a80574942cc9310a1c638999965e46055e7d5ca7e7cf2f5
Parent
accf1b5e4330d73…
1 file changed
+51
-62
+51
-62
| --- src/rss.c | ||
| +++ src/rss.c | ||
| @@ -457,19 +457,19 @@ | ||
| 457 | 457 | |
| 458 | 458 | if( zTagList && zTagList[0]==0 ) zTagList = 0; |
| 459 | 459 | ts = (time_t)((db_column_double(&q,2) - 2440587.5)*86400.0); |
| 460 | 460 | zDate = cgi_rfc822_datestamp(ts); |
| 461 | 461 | |
| 462 | - if( zEType[0]=='c' ){ | |
| 462 | + if( zEType && zEType[0]=='c' ){ | |
| 463 | 463 | if( nParent>1 && nChild>1 ){ |
| 464 | 464 | zPrefix = "*MERGE/FORK* "; |
| 465 | 465 | }else if( nParent>1 ){ |
| 466 | 466 | zPrefix = "*MERGE* "; |
| 467 | 467 | }else if( nChild>1 ){ |
| 468 | 468 | zPrefix = "*FORK* "; |
| 469 | 469 | } |
| 470 | - }else if( zEType[0]=='w' ){ | |
| 470 | + }else if( zEType && zEType[0]=='w' ){ | |
| 471 | 471 | switch(zCom ? zCom[0] : 0){ |
| 472 | 472 | case ':': zPrefix = "Edit wiki page: "; break; |
| 473 | 473 | case '+': zPrefix = "Add wiki page: "; break; |
| 474 | 474 | case '-': zPrefix = "Delete wiki page: "; break; |
| 475 | 475 | } |
| @@ -480,39 +480,33 @@ | ||
| 480 | 480 | zSuffix = mprintf(" (tags: %s)", zTagList); |
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | bHasContent = rss_render_item_html(&contentHtml, &zTechnoteId, rid, zEType, |
| 484 | 484 | blob_str(&base), blob_str(&top)); |
| 485 | - if( bHasContent<0 ){ | |
| 486 | - free(zTechnoteId); | |
| 487 | - blob_reset(&contentHtml); | |
| 488 | - free(zDate); | |
| 489 | - free(zSuffix); | |
| 490 | - continue; | |
| 491 | - } | |
| 492 | - | |
| 493 | - @ <item> | |
| 494 | - @ <title>%s(zPrefix)%h(zCom)%h(zSuffix)</title> | |
| 495 | - if( zTechnoteId!=0 ){ | |
| 496 | - @ <link>%s(g.zBaseURL)/info/%s(zTechnoteId)</link> | |
| 497 | - }else{ | |
| 498 | - @ <link>%s(g.zBaseURL)/info/%s(zId)</link> | |
| 499 | - } | |
| 500 | - if( bHasContent ){ | |
| 501 | - rss_web_emit_html_content(&contentHtml); | |
| 502 | - }else{ | |
| 503 | - @ <description>%s(zPrefix)%h(zCom)%h(zSuffix)</description> | |
| 504 | - } | |
| 505 | - @ <pubDate>%s(zDate)</pubDate> | |
| 506 | - @ <dc:creator>%h(zAuthor)</dc:creator> | |
| 507 | - @ <guid>%s(g.zBaseURL)/info/%s(zId)</guid> | |
| 508 | - @ </item> | |
| 509 | - free(zTechnoteId); | |
| 510 | - blob_reset(&contentHtml); | |
| 511 | - free(zDate); | |
| 512 | - free(zSuffix); | |
| 513 | - nLine++; | |
| 485 | + if( bHasContent>=0 ){ | |
| 486 | + @ <item> | |
| 487 | + @ <title>%s(zPrefix)%h(zCom)%h(zSuffix)</title> | |
| 488 | + if( zTechnoteId ){ | |
| 489 | + @ <link>%s(g.zBaseURL)/info/%s(zTechnoteId)</link> | |
| 490 | + }else{ | |
| 491 | + @ <link>%s(g.zBaseURL)/info/%s(zId)</link> | |
| 492 | + } | |
| 493 | + if( bHasContent ){ | |
| 494 | + rss_web_emit_html_content(&contentHtml); | |
| 495 | + }else{ | |
| 496 | + @ <description>%s(zPrefix)%h(zCom)%h(zSuffix)</description> | |
| 497 | + } | |
| 498 | + @ <pubDate>%s(zDate)</pubDate> | |
| 499 | + @ <dc:creator>%h(zAuthor)</dc:creator> | |
| 500 | + @ <guid>%s(g.zBaseURL)/info/%s(zId)</guid> | |
| 501 | + @ </item> | |
| 502 | + nLine++; | |
| 503 | + } | |
| 504 | + free(zTechnoteId); | |
| 505 | + blob_reset(&contentHtml); | |
| 506 | + free(zDate); | |
| 507 | + free(zSuffix); | |
| 514 | 508 | } |
| 515 | 509 | |
| 516 | 510 | db_finalize(&q); |
| 517 | 511 | blob_reset(&base); |
| 518 | 512 | blob_reset(&top); |
| @@ -703,19 +697,19 @@ | ||
| 703 | 697 | |
| 704 | 698 | if( zTagList && zTagList[0]==0 ) zTagList = 0; |
| 705 | 699 | ts = (time_t)((db_column_double(&q,2) - 2440587.5)*86400.0); |
| 706 | 700 | zDate = cgi_rfc822_datestamp(ts); |
| 707 | 701 | |
| 708 | - if( zEType[0]=='c' ){ | |
| 702 | + if( zEType && zEType[0]=='c' ){ | |
| 709 | 703 | if( nParent>1 && nChild>1 ){ |
| 710 | 704 | zPrefix = "*MERGE/FORK* "; |
| 711 | 705 | }else if( nParent>1 ){ |
| 712 | 706 | zPrefix = "*MERGE* "; |
| 713 | 707 | }else if( nChild>1 ){ |
| 714 | 708 | zPrefix = "*FORK* "; |
| 715 | 709 | } |
| 716 | - }else if( zEType[0]=='w' ){ | |
| 710 | + }else if( zEType && zEType[0]=='w' ){ | |
| 717 | 711 | switch(zCom ? zCom[0] : 0){ |
| 718 | 712 | case ':': zPrefix = "Edit wiki page: "; break; |
| 719 | 713 | case '+': zPrefix = "Add wiki page: "; break; |
| 720 | 714 | case '-': zPrefix = "Delete wiki page: "; break; |
| 721 | 715 | } |
| @@ -726,39 +720,34 @@ | ||
| 726 | 720 | zSuffix = mprintf(" (tags: %s)", zTagList); |
| 727 | 721 | } |
| 728 | 722 | |
| 729 | 723 | bHasContent = rss_render_item_html(&contentHtml, &zTechnoteId, rid, zEType, |
| 730 | 724 | blob_str(&base), blob_str(&top)); |
| 731 | - if( bHasContent<0 ){ | |
| 732 | - free(zTechnoteId); | |
| 733 | - blob_reset(&contentHtml); | |
| 734 | - free(zDate); | |
| 735 | - free(zSuffix); | |
| 736 | - continue; | |
| 737 | - } | |
| 738 | - fossil_print("<item>"); | |
| 739 | - fossil_print("<title>%s%h%h</title>\n", zPrefix, zCom, zSuffix); | |
| 740 | - if( zTechnoteId!=0 ){ | |
| 741 | - fossil_print("<link>%s/info/%s</link>\n", zBaseURL, zTechnoteId); | |
| 742 | - }else{ | |
| 743 | - fossil_print("<link>%s/info/%s</link>\n", zBaseURL, zId); | |
| 744 | - } | |
| 745 | - if( bHasContent ){ | |
| 746 | - rss_cli_emit_html_content(&contentHtml); | |
| 747 | - }else{ | |
| 748 | - fossil_print("<description>%s%h%h</description>\n", | |
| 749 | - zPrefix, zCom, zSuffix); | |
| 750 | - } | |
| 751 | - fossil_print("<pubDate>%s</pubDate>\n", zDate); | |
| 752 | - fossil_print("<dc:creator>%h</dc:creator>\n", zAuthor); | |
| 753 | - fossil_print("<guid>%s/info/%s</guid>\n", g.zBaseURL, zId); | |
| 754 | - fossil_print("</item>\n"); | |
| 755 | - free(zTechnoteId); | |
| 756 | - blob_reset(&contentHtml); | |
| 757 | - free(zDate); | |
| 758 | - free(zSuffix); | |
| 759 | - nLine++; | |
| 725 | + if( bHasContent>=0 ){ | |
| 726 | + fossil_print("<item>"); | |
| 727 | + fossil_print("<title>%s%h%h</title>\n", zPrefix, zCom, zSuffix); | |
| 728 | + if( zTechnoteId!=0 ){ | |
| 729 | + fossil_print("<link>%s/info/%s</link>\n", zBaseURL, zTechnoteId); | |
| 730 | + }else{ | |
| 731 | + fossil_print("<link>%s/info/%s</link>\n", zBaseURL, zId); | |
| 732 | + } | |
| 733 | + if( bHasContent ){ | |
| 734 | + rss_cli_emit_html_content(&contentHtml); | |
| 735 | + }else{ | |
| 736 | + fossil_print("<description>%s%h%h</description>\n", | |
| 737 | + zPrefix, zCom, zSuffix); | |
| 738 | + } | |
| 739 | + fossil_print("<pubDate>%s</pubDate>\n", zDate); | |
| 740 | + fossil_print("<dc:creator>%h</dc:creator>\n", zAuthor); | |
| 741 | + fossil_print("<guid>%s/info/%s</guid>\n", g.zBaseURL, zId); | |
| 742 | + fossil_print("</item>\n"); | |
| 743 | + nLine++; | |
| 744 | + } | |
| 745 | + free(zTechnoteId); | |
| 746 | + blob_reset(&contentHtml); | |
| 747 | + free(zDate); | |
| 748 | + free(zSuffix); | |
| 760 | 749 | } |
| 761 | 750 | |
| 762 | 751 | db_finalize(&q); |
| 763 | 752 | blob_reset(&base); |
| 764 | 753 | blob_reset(&top); |
| 765 | 754 |
| --- src/rss.c | |
| +++ src/rss.c | |
| @@ -457,19 +457,19 @@ | |
| 457 | |
| 458 | if( zTagList && zTagList[0]==0 ) zTagList = 0; |
| 459 | ts = (time_t)((db_column_double(&q,2) - 2440587.5)*86400.0); |
| 460 | zDate = cgi_rfc822_datestamp(ts); |
| 461 | |
| 462 | if( zEType[0]=='c' ){ |
| 463 | if( nParent>1 && nChild>1 ){ |
| 464 | zPrefix = "*MERGE/FORK* "; |
| 465 | }else if( nParent>1 ){ |
| 466 | zPrefix = "*MERGE* "; |
| 467 | }else if( nChild>1 ){ |
| 468 | zPrefix = "*FORK* "; |
| 469 | } |
| 470 | }else if( zEType[0]=='w' ){ |
| 471 | switch(zCom ? zCom[0] : 0){ |
| 472 | case ':': zPrefix = "Edit wiki page: "; break; |
| 473 | case '+': zPrefix = "Add wiki page: "; break; |
| 474 | case '-': zPrefix = "Delete wiki page: "; break; |
| 475 | } |
| @@ -480,39 +480,33 @@ | |
| 480 | zSuffix = mprintf(" (tags: %s)", zTagList); |
| 481 | } |
| 482 | |
| 483 | bHasContent = rss_render_item_html(&contentHtml, &zTechnoteId, rid, zEType, |
| 484 | blob_str(&base), blob_str(&top)); |
| 485 | if( bHasContent<0 ){ |
| 486 | free(zTechnoteId); |
| 487 | blob_reset(&contentHtml); |
| 488 | free(zDate); |
| 489 | free(zSuffix); |
| 490 | continue; |
| 491 | } |
| 492 | |
| 493 | @ <item> |
| 494 | @ <title>%s(zPrefix)%h(zCom)%h(zSuffix)</title> |
| 495 | if( zTechnoteId!=0 ){ |
| 496 | @ <link>%s(g.zBaseURL)/info/%s(zTechnoteId)</link> |
| 497 | }else{ |
| 498 | @ <link>%s(g.zBaseURL)/info/%s(zId)</link> |
| 499 | } |
| 500 | if( bHasContent ){ |
| 501 | rss_web_emit_html_content(&contentHtml); |
| 502 | }else{ |
| 503 | @ <description>%s(zPrefix)%h(zCom)%h(zSuffix)</description> |
| 504 | } |
| 505 | @ <pubDate>%s(zDate)</pubDate> |
| 506 | @ <dc:creator>%h(zAuthor)</dc:creator> |
| 507 | @ <guid>%s(g.zBaseURL)/info/%s(zId)</guid> |
| 508 | @ </item> |
| 509 | free(zTechnoteId); |
| 510 | blob_reset(&contentHtml); |
| 511 | free(zDate); |
| 512 | free(zSuffix); |
| 513 | nLine++; |
| 514 | } |
| 515 | |
| 516 | db_finalize(&q); |
| 517 | blob_reset(&base); |
| 518 | blob_reset(&top); |
| @@ -703,19 +697,19 @@ | |
| 703 | |
| 704 | if( zTagList && zTagList[0]==0 ) zTagList = 0; |
| 705 | ts = (time_t)((db_column_double(&q,2) - 2440587.5)*86400.0); |
| 706 | zDate = cgi_rfc822_datestamp(ts); |
| 707 | |
| 708 | if( zEType[0]=='c' ){ |
| 709 | if( nParent>1 && nChild>1 ){ |
| 710 | zPrefix = "*MERGE/FORK* "; |
| 711 | }else if( nParent>1 ){ |
| 712 | zPrefix = "*MERGE* "; |
| 713 | }else if( nChild>1 ){ |
| 714 | zPrefix = "*FORK* "; |
| 715 | } |
| 716 | }else if( zEType[0]=='w' ){ |
| 717 | switch(zCom ? zCom[0] : 0){ |
| 718 | case ':': zPrefix = "Edit wiki page: "; break; |
| 719 | case '+': zPrefix = "Add wiki page: "; break; |
| 720 | case '-': zPrefix = "Delete wiki page: "; break; |
| 721 | } |
| @@ -726,39 +720,34 @@ | |
| 726 | zSuffix = mprintf(" (tags: %s)", zTagList); |
| 727 | } |
| 728 | |
| 729 | bHasContent = rss_render_item_html(&contentHtml, &zTechnoteId, rid, zEType, |
| 730 | blob_str(&base), blob_str(&top)); |
| 731 | if( bHasContent<0 ){ |
| 732 | free(zTechnoteId); |
| 733 | blob_reset(&contentHtml); |
| 734 | free(zDate); |
| 735 | free(zSuffix); |
| 736 | continue; |
| 737 | } |
| 738 | fossil_print("<item>"); |
| 739 | fossil_print("<title>%s%h%h</title>\n", zPrefix, zCom, zSuffix); |
| 740 | if( zTechnoteId!=0 ){ |
| 741 | fossil_print("<link>%s/info/%s</link>\n", zBaseURL, zTechnoteId); |
| 742 | }else{ |
| 743 | fossil_print("<link>%s/info/%s</link>\n", zBaseURL, zId); |
| 744 | } |
| 745 | if( bHasContent ){ |
| 746 | rss_cli_emit_html_content(&contentHtml); |
| 747 | }else{ |
| 748 | fossil_print("<description>%s%h%h</description>\n", |
| 749 | zPrefix, zCom, zSuffix); |
| 750 | } |
| 751 | fossil_print("<pubDate>%s</pubDate>\n", zDate); |
| 752 | fossil_print("<dc:creator>%h</dc:creator>\n", zAuthor); |
| 753 | fossil_print("<guid>%s/info/%s</guid>\n", g.zBaseURL, zId); |
| 754 | fossil_print("</item>\n"); |
| 755 | free(zTechnoteId); |
| 756 | blob_reset(&contentHtml); |
| 757 | free(zDate); |
| 758 | free(zSuffix); |
| 759 | nLine++; |
| 760 | } |
| 761 | |
| 762 | db_finalize(&q); |
| 763 | blob_reset(&base); |
| 764 | blob_reset(&top); |
| 765 |
| --- src/rss.c | |
| +++ src/rss.c | |
| @@ -457,19 +457,19 @@ | |
| 457 | |
| 458 | if( zTagList && zTagList[0]==0 ) zTagList = 0; |
| 459 | ts = (time_t)((db_column_double(&q,2) - 2440587.5)*86400.0); |
| 460 | zDate = cgi_rfc822_datestamp(ts); |
| 461 | |
| 462 | if( zEType && zEType[0]=='c' ){ |
| 463 | if( nParent>1 && nChild>1 ){ |
| 464 | zPrefix = "*MERGE/FORK* "; |
| 465 | }else if( nParent>1 ){ |
| 466 | zPrefix = "*MERGE* "; |
| 467 | }else if( nChild>1 ){ |
| 468 | zPrefix = "*FORK* "; |
| 469 | } |
| 470 | }else if( zEType && zEType[0]=='w' ){ |
| 471 | switch(zCom ? zCom[0] : 0){ |
| 472 | case ':': zPrefix = "Edit wiki page: "; break; |
| 473 | case '+': zPrefix = "Add wiki page: "; break; |
| 474 | case '-': zPrefix = "Delete wiki page: "; break; |
| 475 | } |
| @@ -480,39 +480,33 @@ | |
| 480 | zSuffix = mprintf(" (tags: %s)", zTagList); |
| 481 | } |
| 482 | |
| 483 | bHasContent = rss_render_item_html(&contentHtml, &zTechnoteId, rid, zEType, |
| 484 | blob_str(&base), blob_str(&top)); |
| 485 | if( bHasContent>=0 ){ |
| 486 | @ <item> |
| 487 | @ <title>%s(zPrefix)%h(zCom)%h(zSuffix)</title> |
| 488 | if( zTechnoteId ){ |
| 489 | @ <link>%s(g.zBaseURL)/info/%s(zTechnoteId)</link> |
| 490 | }else{ |
| 491 | @ <link>%s(g.zBaseURL)/info/%s(zId)</link> |
| 492 | } |
| 493 | if( bHasContent ){ |
| 494 | rss_web_emit_html_content(&contentHtml); |
| 495 | }else{ |
| 496 | @ <description>%s(zPrefix)%h(zCom)%h(zSuffix)</description> |
| 497 | } |
| 498 | @ <pubDate>%s(zDate)</pubDate> |
| 499 | @ <dc:creator>%h(zAuthor)</dc:creator> |
| 500 | @ <guid>%s(g.zBaseURL)/info/%s(zId)</guid> |
| 501 | @ </item> |
| 502 | nLine++; |
| 503 | } |
| 504 | free(zTechnoteId); |
| 505 | blob_reset(&contentHtml); |
| 506 | free(zDate); |
| 507 | free(zSuffix); |
| 508 | } |
| 509 | |
| 510 | db_finalize(&q); |
| 511 | blob_reset(&base); |
| 512 | blob_reset(&top); |
| @@ -703,19 +697,19 @@ | |
| 697 | |
| 698 | if( zTagList && zTagList[0]==0 ) zTagList = 0; |
| 699 | ts = (time_t)((db_column_double(&q,2) - 2440587.5)*86400.0); |
| 700 | zDate = cgi_rfc822_datestamp(ts); |
| 701 | |
| 702 | if( zEType && zEType[0]=='c' ){ |
| 703 | if( nParent>1 && nChild>1 ){ |
| 704 | zPrefix = "*MERGE/FORK* "; |
| 705 | }else if( nParent>1 ){ |
| 706 | zPrefix = "*MERGE* "; |
| 707 | }else if( nChild>1 ){ |
| 708 | zPrefix = "*FORK* "; |
| 709 | } |
| 710 | }else if( zEType && zEType[0]=='w' ){ |
| 711 | switch(zCom ? zCom[0] : 0){ |
| 712 | case ':': zPrefix = "Edit wiki page: "; break; |
| 713 | case '+': zPrefix = "Add wiki page: "; break; |
| 714 | case '-': zPrefix = "Delete wiki page: "; break; |
| 715 | } |
| @@ -726,39 +720,34 @@ | |
| 720 | zSuffix = mprintf(" (tags: %s)", zTagList); |
| 721 | } |
| 722 | |
| 723 | bHasContent = rss_render_item_html(&contentHtml, &zTechnoteId, rid, zEType, |
| 724 | blob_str(&base), blob_str(&top)); |
| 725 | if( bHasContent>=0 ){ |
| 726 | fossil_print("<item>"); |
| 727 | fossil_print("<title>%s%h%h</title>\n", zPrefix, zCom, zSuffix); |
| 728 | if( zTechnoteId!=0 ){ |
| 729 | fossil_print("<link>%s/info/%s</link>\n", zBaseURL, zTechnoteId); |
| 730 | }else{ |
| 731 | fossil_print("<link>%s/info/%s</link>\n", zBaseURL, zId); |
| 732 | } |
| 733 | if( bHasContent ){ |
| 734 | rss_cli_emit_html_content(&contentHtml); |
| 735 | }else{ |
| 736 | fossil_print("<description>%s%h%h</description>\n", |
| 737 | zPrefix, zCom, zSuffix); |
| 738 | } |
| 739 | fossil_print("<pubDate>%s</pubDate>\n", zDate); |
| 740 | fossil_print("<dc:creator>%h</dc:creator>\n", zAuthor); |
| 741 | fossil_print("<guid>%s/info/%s</guid>\n", g.zBaseURL, zId); |
| 742 | fossil_print("</item>\n"); |
| 743 | nLine++; |
| 744 | } |
| 745 | free(zTechnoteId); |
| 746 | blob_reset(&contentHtml); |
| 747 | free(zDate); |
| 748 | free(zSuffix); |
| 749 | } |
| 750 | |
| 751 | db_finalize(&q); |
| 752 | blob_reset(&base); |
| 753 | blob_reset(&top); |
| 754 |