AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Hilfe mit Delphi [idhttp.get error]

Ein Thema von RooT314 · begonnen am 31. Mär 2015 · letzter Beitrag vom 1. Apr 2015
 
Perlsau
(Gast)

n/a Beiträge
 
#11

AW: Hilfe mit Delphi [idhttp.get error]

  Alt 1. Apr 2015, 10:04
Jupp, aber dann vor dem Try natürlich nicht das :=nil vergessen, denn sonst knallt auch noch das Free, da nicht initialisiert, wenn es im Create knallte.
Echt jetzt? Aprilscherz? In der Unit System wird doch bereits auf Nil geprüft und Destroy nur ausgeführt, wenn nicht Nil:
Delphi-Quellcode:
procedure TObject.Free;
begin
// under ARC, this method isn't actually called since the compiler translates
// the call to be a mere nil assignment to the instance variable, which then calls _InstClear
{$IFNDEF AUTOREFCOUNT}
  if Self <> nil then
    Destroy;
{$ENDIF}
end;
Und wird eine Objektvariable nicht automatisch bei der Deklaration mit Nil initialisiert? Oder muß ich das dann auch bereits vor dem ersten Try machen?
So dürfte es dann wohl hinhauen:
Delphi-Quellcode:
Function TDatMod.BlobFeldInDatei(Feld: TField; Datei: String): Boolean;
Var
  S : TStream;
  FileS : TFileStream;

begin
  Result := False;

  ...

  Try
    S := Feld.DataSet.CreateBlobStream(Feld, bmRead);
    FileS := TFileStream.Create(Datei, fmCreate);
    Try
      FileS.CopyFrom(S, S.Size);
      Result := True;
    Except
      on e:exception Do GLD.FehlerText := 'Fehler bei BlobToFile: ' + e.Message;
    End;
  Finally
    S.Free;
    FileS.Free;
  End;
end;
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 08:34 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz