@@ -563,8 +563,7 @@ protected virtual PathModel AddPath(string path)
563563 {
564564 try
565565 {
566- if ( path == null || path . Length == 0 )
567- return null ;
566+ if ( string . IsNullOrEmpty ( path ) ) return null ;
568567 if ( Directory . Exists ( path ) ) path = NormalizePath ( path ) ;
569568 else if ( File . Exists ( path ) ) path = NormalizeFilename ( path ) ;
570569 else return null ;
@@ -813,32 +812,37 @@ public virtual bool UnsetOutOfDate()
813812 /// <returns>File model</returns>
814813 public virtual FileModel GetCachedFileModel ( string fileName )
815814 {
816- if ( fileName == null || fileName . Length == 0 || ! File . Exists ( fileName ) )
815+ if ( string . IsNullOrEmpty ( fileName ) || ! File . Exists ( fileName ) )
817816 return new FileModel ( fileName ) ;
818817
819818 FileModel nFile ;
820819 fileName = PathHelper . GetLongPathName ( fileName ) ;
821-
822- // check if in cache
823- foreach ( PathModel aPath in classPath )
820+ if ( classPath != null )
824821 {
825- if ( aPath . HasFile ( fileName ) )
822+ // check if in cache
823+ foreach ( PathModel aPath in classPath )
826824 {
827- nFile = aPath . GetFile ( fileName ) ;
828- nFile . Check ( ) ;
829- return nFile ;
825+ if ( aPath . HasFile ( fileName ) )
826+ {
827+ nFile = aPath . GetFile ( fileName ) ;
828+ nFile . Check ( ) ;
829+ return nFile ;
830+ }
830831 }
831832 }
832833
833834 // parse and add to cache
834835 nFile = ASFileParser . ParseFile ( CreateFileModel ( fileName ) ) ;
835- string upName = fileName . ToUpper ( ) ;
836- foreach ( PathModel aPath in classPath )
836+ if ( classPath != null )
837837 {
838- if ( upName . StartsWith ( aPath . Path , StringComparison . OrdinalIgnoreCase ) )
838+ string upName = fileName . ToUpper ( ) ;
839+ foreach ( PathModel aPath in classPath )
839840 {
840- aPath . AddFile ( nFile ) ;
841- return nFile ;
841+ if ( upName . StartsWith ( aPath . Path , StringComparison . OrdinalIgnoreCase ) )
842+ {
843+ aPath . AddFile ( nFile ) ;
844+ return nFile ;
845+ }
842846 }
843847 }
844848
@@ -950,8 +954,7 @@ public virtual FileModel GetCodeModel(string src)
950954 // parse
951955 FileModel temp = new FileModel ( ) ;
952956 temp . haXe = ASContext . Context . Settings . LanguageId == "HAXE" ;
953- if ( src != null && src . Trim ( ) . Length > 0 )
954- parser . ParseSrc ( temp , src ) ;
957+ if ( ! string . IsNullOrEmpty ( src ) ) parser . ParseSrc ( temp , src ) ;
955958 return temp ;
956959 }
957960
@@ -987,7 +990,7 @@ protected virtual void GetCurrentFileModel(string fileName)
987990 cFile . Context = this ;
988991 UpdateCurrentFile ( false ) ; // does update line & context
989992 }
990- else
993+ else if ( CurSciControl != null )
991994 {
992995 cLine = CurSciControl . LineFromPosition ( CurSciControl . CurrentPos ) ;
993996 UpdateContext ( cLine ) ;
@@ -1460,7 +1463,7 @@ public void MakeIntrinsic(string files)
14601463 {
14611464 string src = null ;
14621465 string dest = null ;
1463- if ( ( files != null ) && ( files . Length > 0 ) )
1466+ if ( ! string . IsNullOrEmpty ( files ) )
14641467 {
14651468 string [ ] list = files . Split ( ';' ) ;
14661469 if ( list . Length == 1 ) dest = list [ 0 ] ;
@@ -1516,23 +1519,19 @@ static protected string GetStatusText()
15161519
15171520 static public string NormalizeFilename ( string path )
15181521 {
1519- if ( path == null )
1520- return "" ;
1522+ if ( string . IsNullOrEmpty ( path ) ) return "" ;
15211523 path = path . Trim ( ) ;
1522- if ( path . Length == 0 )
1523- return path ;
1524+ if ( path . Length == 0 ) return path ;
15241525 if ( doPathNormalization )
15251526 path = path . Replace ( dirAltSeparator , dirSeparator ) ;
15261527 path = path . Replace ( dirSeparator + dirSeparator , dirSeparator ) ;
15271528 return PathHelper . GetLongPathName ( path ) ;
15281529 }
15291530 static public string NormalizePath ( string path )
15301531 {
1531- if ( path == null )
1532- return "" ;
1532+ if ( string . IsNullOrEmpty ( path ) ) return "" ;
15331533 path = path . Trim ( ) ;
1534- if ( path . Length == 0 )
1535- return path ;
1534+ if ( path . Length == 0 ) return path ;
15361535 if ( doPathNormalization )
15371536 path = path . Replace ( dirAltSeparator , dirSeparator ) ;
15381537 if ( ! path . EndsWith ( dirSeparator ) )
0 commit comments