Browse Source

* fix aspell runtime error in windows if no library (register keys) are present

git-svn-id: trunk@10348 -
Almindor 17 years ago
parent
commit
141defd182
1 changed files with 6 additions and 5 deletions
  1. 6 5
      packages/aspell/src/aspell.pp

+ 6 - 5
packages/aspell/src/aspell.pp

@@ -1013,7 +1013,6 @@ uses
 
 var
   LibHandle: TLibHandle = 0;
-  AspellInited_: Boolean;
 
 {$IFDEF WINDOWS}
 function RegistryQueryValue (name,sub:shortstring):shortstring;
@@ -1057,10 +1056,12 @@ begin
   
   {$IFDEF windows}
   bversion := RegistryQueryValue('SOFTWARE\Aspell','AspellVersion');
-  move(bversion[1], version, 4);
-  path := RegistryQueryValue('SOFTWARE\Aspell','Path');
-  // will work if they passed %s, won't bork if they passed absolute
-  libname := path + PathDelim + StringReplace(libn, '%s', IntToStr(Version), [rfReplaceAll]);
+  if Length(bversion) >= 4 then begin
+    move(bversion[1], version, 4);
+    path := RegistryQueryValue('SOFTWARE\Aspell','Path');
+    // will work if they passed %s, won't bork if they passed absolute
+    libname := path + PathDelim + StringReplace(libn, '%s', IntToStr(Version), [rfReplaceAll]);
+  end;
   {$ENDIF}
 
   LibHandle := LoadLibrary(libname);