소스 검색

Added a parameter check in ReplaceText: both oldValue and newValue should be != null and length > 0. Patch provided by HeDo

master
MadBoy_cp 12 년 전
부모
커밋
0244b12226
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  1. 6
    0
      DocX/Container.cs

+ 6
- 0
DocX/Container.cs 파일 보기

@@ -360,6 +360,12 @@ namespace Novacode
public virtual void ReplaceText(string oldValue, string newValue, bool trackChanges = false, RegexOptions options = RegexOptions.None, Formatting newFormatting = null, Formatting matchFormatting = null, MatchFormattingOptions fo = MatchFormattingOptions.SubsetMatch)
{
// PATCH BY HeDo - Arguments check!
if (oldValue == null || oldValue.Length == 0)
throw new ArgumentException("oldValue cannot be null or empty", "oldValue");
if (newValue == null || newValue.Length == 0)
throw new ArgumentException("newValue cannot be null or empty", "newValue");
// ReplaceText in Headers of the document.
Headers headers = Document.Headers;
List<Header> headerList = new List<Header> { headers.first, headers.even, headers.odd };

Loading…
취소
저장